PRU-ICSS Migration Guide: AM335x to AM57x

From Texas Instruments Wiki
Jump to: navigation, search



Introduction

This article serves as a Software Migration Guide to assist in porting legacy software developed for the Programmable Real-Time Unit Subsystem and Industrial Communication Subsystem (PRU-ICSS) on AM335x to AM57x platforms. This guide will detail the PRU subsystem hardware differences and outline software modifications required for porting PRU firmware and ARM code to AM57x.

Refer to the PRU-ICSS chapter in the AM335x and AM572x/AM571x Technical Reference Manual for details about the PRU-ICSS on each device.

        NOTE:    The focus of this article is broad market support. Some industrial specific or ICSS features may be omitted.        




AM335x and AM57x Hardware Differences

This section provides an overview of the hardware differences between AM335x and AM57x. Both a high-level overview of the SoC-level hardware differences and a detailed overview of the PRU-ICSS hardware differences are included.

SoC-level Hardware Differences

AM335x and AM57x devices support different peripherals and features. The SoC memory map, peripheral register map, pinmuxing, ARM interrupt controller events, and eDMA mapping also differ between the devices.

Table 1 provides a quick comparison of the peripherals and features offered on AM335x and AM57x. For additional details, refer to the device-specific data sheets and user guides available at the device product pages:


Table 1. AM335x and AM57x Feature Comparison
Device Family AM335x AM572x AM571x
Device Family AM3357/6/2 - CortexA8 
AM3359/8/4 - CortexA8 with SGX530
AM5726 - 2x CortexA15, 2x C66x DSP 
AM5728 - 2x CortexA15, 2x C66x DSP with 2x SGX544
AM5716 - 1x CortexA15, 1x C66x DSP 
AM5718 - 1x CortexA15, 1x C66x DSP with 1x SGX544
Package Options    
Packages 284-pin nFBGA (ZCE), .65-mm Ball Pitch with VCA
324-Pin nFBGA (ZCZ), .80-mm Ball Pitch Full Array
23 x 23mm, 0.8-mm Pitch, 760 Pin BGA (ABC)
Co-processors and Subsystems    
ARM Cortex-A Processor 1x Cortex-A8 up to 1GHz;
32K-Byte Instruction and Data Caches;
256K-Byte L2 Cache w/ECC
2x Cortex-A15 up to 1.5GHz;
32K-Byte Instruction and Data Caches;
2M-Byte L2 Cache
1x Cortex-A15 up to 1.5GHz;
32K-Byte Instruction and Data Caches;
2M-Byte L2 Cache
Supported OPP: 50%/100%/120%/Turbo/Nitro Supported OPP: NOM, OD, HIGH
DSP Processor not present 2x C66x VLIW DSP up to 750MHz;
32K-Byte Instruction and Data Caches;
288K-Byte L2 Cache
1x C66x VLIW DSP up to 750MHz;
32K-Byte Instruction and Data Caches;
288K-Byte L2 Cache
ARM Cortex-M Processor available for General Purpose Use not present 1x Dual Cortex-M4 up to 213MHz;
32K-Byte Shared L1 Cache;
64K-Byte L2 RAM; 16K-Byte bootable L2 ROM
1x Dual Cortex-M4 up to 213MHz;
32K-Byte Shared L1 Cache;
64K-Byte L2 RAM; 16K-Byte bootable L2 ROM
Neon Co-processor Y Y
Graphics Engine 1x SGX530 3D 2x SGX544 3D;
1x GC320 2D
1x SGX544 3D;
1x GC320 2D
System DMA eDMA eDMA, SDMA
PRU-ICSS 1 2
Memory Interfaces:    
mDDR/DDR2/DDR3 Controller Single 16-bit LPDDR/DDR2/DDR3 SDRAM Interface
Supports up to LPDDR-400, DDR2-532, DDR3-800, DDR3L-800
Total 1 GB Total Address Space
Dual 16/32-bit DDR3L/DDR3 SDRAM
Supports up to DDR3-1066
2 GB address space per EMIF (4 GB total)
Single 16/32-bit DDR3L/DDR3 SDRAM
Supports up to DDR3-1333
Up to 2 GB across single chip select
Dynamic Memory Manager (DMM) N Y
GPMC Y Y
ELM Y Y
SATA N Y
On Chip Memory (OCMC) 64KB (general purpose) 2.5MB 512KB
Security    
Crypto hardware accelerators Y Y
Video Interfaces:    
Image and Video Accelerator N Y
Video Input Port (VIP) N 3 1
Video Processing Engine (VPE) N Y
Camera Serial Interface (CSI) N N 2
Display LCD Controller Display Subsystem (DSS)
Peripherals    
USB OTG Two (2) USB 2.0 High Speed ports with integrated PHY (13 x 13 Package has only one USB port) One (1) USB 3.0 Super Speed, Dual-Role-Device [DRD]
One (1) USB 2.0 High Speed, Dual-Role-Device [DRD] with integrated PHY
eMAC 2 (10/100/1000 Mbps) 2 (10/100/1000 Mbps)
CAN 2 2
McASP 2 (Both with 4 serializers) 8 (Two with 16 serializers, Six with 4 serializers)
UART 6 (all with IrDA) 10 (one with IrDA)
McSPI 2 4
QSPI not present 1
I2C 3 5
GPIO Up to 128 Up to 247 Up to 215
Keyboard Controller not present 1
eCAP 3 3
eHRPWM 3 3
eQPE 3 3
ADC 1 (TSC/ADC) not present
PCIe not present 2
Removable Media    
MMC/SD/SDIO 3 4
D1W/HDQ N Y
Power, Reset, and Clock Management    
RTC Y Y
Test Interfaces    
JTAG Y Y
ETM, PTM, & ETB ETM & ETB ETM
IEEE 1500 support Y N
Misc    
GP Timer 7 16
Watchdog Timer 1 1


PRU-ICSS Hardware Differences between AM335x and AM57x

The table here compares the PRU-ICSS hardware between AM335x and AM57x. One primary difference is that AM335x has one instance of the PRU-ICSS, while AM57x has two instances.

Below shows a comparison block diagram of the subsystems:

Figure 1. AM335x PRU-ICSS block diagram


Figure 2. AM57x PRU-ICSS block diagram

PRU-ICSS Memory Map Comparison

Local and Global Memory Maps

The AM57x PRU-ICSS local and global memory maps are backwards compatible with AM335x. However, the PRU-ICSS base address within the SoC memory map differs between devices. Table 2 compares these base addresses, which function as the starting address for the PRU-ICSS global memory map.

Table 2. PRU-ICSS Base Address Comparison for Global Memory Map
AM335x
AM57x (PRU-ICSS1)
AM57x (PRU-ICSS2)
Start Address
0x4A30_0000  0x4B20_0000  0x4B28_0000



PRU-ICSS Submodules Register Content and Offsets

The register content and offsets of the following PRU-ICSS submodules are identical on AM335x and AM57x:

  • PRU-ICSS INTC
  • PRU-ICSS PRU<n> Control
  • PRU-ICSS PRU<n> Debug
  • PRU-ICSS UART
  • PRU-ICSS eCAP

The register content and offsets of the following PRU-ICSS submodules are identical on AM572x SR1.1 but are backwards compatible on AM572x SR2.0 and AM571x:

  • PRU-ICSS IEP
  • PRU-ICSS CFG

Constants Table Differences

The PRU-ICSS constant table entries are partially backwards compatible.

Table 3. Constant Table Differences
Entry No. Value [31:0]
AM335x Function
AM57x Function
PRU-ICSS1 PRU-ICSS1 / PRU-ICSS2
0 0x0002_0000
PRU-ICSS INTC (local)
PRU-ICSS INTC (local)
1 0x4804_0000
DMTIMER2
Reserved
2 0x4802_A000
I2C1
Reserved
3 0x0003_0000
PRU-ICSS eCAP (local)
IRQ_CROSSBAR_21
(MAILBOX1_IRQ_USER0)
4 0x0002_6000
PRU-ICSS CFG (local)
PRU-ICSS CFG (local)
5 0x4806_0000
MMCHS 0
I2C3
6 0x4803_0000
MCSPI 0
Reserved
7 0x0002_8000
PRU-ICSS UART0 (local)
PRU-ICSS UART0 (local)
8 0x4600_0000
McASP0 DMA
McASP3 DAT
9 0x4A10_0000
GEMAC
Reserved
10 0x4831_8000
Reserved
Reserved
11 0x4802_2000
UART1
Reserved
12 0x4802_4000
UART2
Reserved
13 0x4831_0000
Reserved
Reserved
14 0x481C_C000
DCAN0
Reserved
15 0x481D_0000
DCAN1
Reserved
16 0x481A_0000
MCSPI 1
Reserved
17 0x4819_C0000
I2C2
Reserved
18 0x4830_0000
eHRPWM1/eCAP1/eQEP1
Reserved
19 0x4830_2000
eHRPWM2/eCAP2/eQEP2
Reserved
20 0x4830_4000
eHRPWM3/eCAP3/eQEP3
Reserved
21 0x0003_2400
Reserved
Reserved
22 0x480C_8000
Mailbox 0
Reserved
23 0x480C_A000
Spinlock
Reserved
24 0x0000_0n00, n = c24_blk_index[3:0]
PRU-ICSS PRU0/1 Data RAM (local)
PRU-ICSS PRU0/1 Data RAM (local)
25 0x0000_2n00, n = c25_blk_index[3:0]
PRU-ICSS PRU1/0 Data RAM (local)
PRU-ICSS PRU1/0 Data RAM (local)
26 0x0002_En00, n = c26_blk_index[3:0]
PRU-ICSS IEP (local)
PRU-ICSS IEP (local)
27 0x0003_2n00, n = c27_blk_index[3:0]
Reserved
Reserved
28 0x00nn_nn00, nnnn = c28_pointer[15:0]
PRU-ICSS Shared RAM (local)
PRU-ICSS Shared RAM (local)
29 0x49nn_nn00, nnnn = c29_pointer[15:0]
TPCC
OCMC_RAM2_CBUF
30 0x40nn_nn00, nnnn = c30_pointer[15:0]
L3 OCMC0
OCMC_RAM
31 0x80nn_nn00, nnnn = c31_pointer[15:0]
EMIF0 DDR Base
EMIF1_SDRAM_CS0


PRU Module Interface to PRU I/Os Differences

The functionality and structure of R30 and R31 is preserved on AM57x. The supported GPI / GPO modes are backwards compatible.

The number of PRU I/Os pinned out on each device differs, but the AM57x is backwards compatible with AM335x. The PRU-ICSS_Feature_Comparison table shows what I/Os are pinned out on each device.

Interrupt Controller Differences

The basic structure of the interrupt controller is the same in both devices. The basic INTC mapping of system events to channels to hosts is still the same. Both devices support the same number of total system events (64), channels (16), and hosts (10).

The INTC system events from modules inside the PRU-ICSS (i.e. System Event 0-31) are identical. The INTC system events from external sources (i.e. System Event 32-63) are not backwards compatible by default. However, AM57xx implements an Interrupt Controller Crossbar that provides flexibility in configuring the INTC system event source. At boot, the INTC can be configured to match the AM335x System Events. Table 3 shows which AM57xx IRQ_CROSSBAR events match the the AM335x external system events.

The ARM interrupt numbers mapped to the PRU-ICSS source interrupts have also been updated on AM57x. See Table 4 for these changes.


Table 3. INTC Event Differences
Event
AM335x Function
AM57x Function
PRU-ICSS1 PRU-ICSS1 / PRU-ICSS2
63
TPCC (EDMA) - tpcc_int_pend_po1
IRQ_CROSSBAR_361
(EDMA_TPCC_IRQ_REGION0)
62
TPCC (EDMA) - tpcc_errint_pend_po
IRQ_CROSSBAR_359
(EDMA_TPCC_IRQ_ERR)
61
TPTC0 (EDMA) - tptc_erint_pend_po
IRQ_CROSSBAR_370
(EDMA_TC0_IRQ_ERR)
60
Mailbox0 - mail_u1_irq
IRQ_CROSSBAR_21
(MAILBOX1_IRQ_USER0)
59
Mailbox0 - mail_u2_irq
IRQ_CROSSBAR_135
(MAILBOX1_IRQ_USER1)
58
Debugss
N/A
57
GPIO0
IRQ_CROSSBAR_24
(GPIO1_IRQ_1)
56
eHRPWM0-2 Trip Zone
IRQ_CROSSBAR_204 *
(PWMSS1_IRQ_ePWM0_TZINT)
55
McASP0 Tx
IRQ_CROSSBAR_104
(McASP1_IRQ_AXEVT)
54
McASP0 Rx
IRQ_CROSSBAR_103
(McASP1_IRQ_AREVT)
53
ADC_TSC
N/A
52
UART2
IRQ_CROSSBAR_69
(UART3_IRQ)
51
UART0
IRQ_CROSSBAR_67
(UART1_IRQ)
50
CPSW (c0_rx_thresh_pend)
IRQ_CROSSBAR_334
(GMAC_SW_IRQ_RX_THRESH_PULSE)
49
CPSW (c0_rx_pend)
IRQ_CROSSBAR_335
(GMAC_SW_IRQ_RX_PULSE)
48
CPSW (c0_tx_pend)
IRQ_CROSSBAR_336
(GMAC_SW_IRQ_TX_PULSE)
47
CPSW (c0_misc_pend)
IRQ_CROSSBAR_337
(GMAC_SW_IRQ_MISC_PULSE)
46
eHRPWM1
IRQ_CROSSBAR_208
(PWMSS2_IRQ_ePWM1INT)
45
eQEP0
IRQ_CROSSBAR_210
(PWMSS1_IRQ_eQEP0INT)
44
McSPI0
IRQ_CROSSBAR_60
(MCSPI1_IRQ)
43
eHRPWM0
IRQ_CROSSBAR_207
(PWMSS1_IRQ_ePWM0INT)
42
eCAP0
IRQ_CROSSBAR_213
(PWMSS1_IRQ_eCAP0INT)
41
I2C0
IRQ_CROSSBAR_51
(I2C1_IRQ)
40
DCAN0 (dcan_intr)
IRQ_CROSSBAR_222
(DCAN1_IRQ_INT0)
39
DCAN0 (dcan_int1)
IRQ_CROSSBAR_223
(DCAN1_IRQ_INT1)
38
DCAN0 (dcan_uerr)
IRQ_CROSSBAR_224
(DCAN1_IRQ_PARITY)
37
eHRPWM2
IRQ_CROSSBAR_209
(PWMSS3_IRQ_ePWM2INT)
36
eCAP2
IRQ_CROSSBAR_215
(PWMSS3_IRQ_eCAP2INT)
35
eCAP1
IRQ_CROSSBAR_214
(PWMSS2_IRQ_eCAP1INT)
34
McASP1 RX
IRQ_CROSSBAR_148
(McASP2_IRQ_AREVT)
33
McASP1 TX
IRQ_CROSSBAR_149
(McASP2_IRQ_AXEVT)
32
UART1
IRQ_CROSSBAR_68
(UART2_IRQ)


* Note that the AM335x PWM TZ event is associated with three PWM instances (PWM0-2), but the AM57xx event is only associated with one PWM instance.



Table 4. ARM Mapping of Source Interrupt to Event Number Comparison
Source
AM335x Event Number
AM57x Event Number
PRU-ICSS1 PRU-ICSS1 PRU-ICSS2
PRU_ICSS<k>_EVTOUT0
20
186
196
PRU_ICSS<k>_EVTOUT1
21
187
197
PRU_ICSS<k>_EVTOUT2
22
188
198
PRU_ICSS<k>_EVTOUT3
23
189
199
PRU_ICSS<k>_EVTOUT4
24
190
200
PRU_ICSS<k>_EVTOUT5
25
191
201
PRU_ICSS<k>_EVTOUT6
26
192
202
PRU_ICSS<k>_EVTOUT7
27
193
203

Peripheral Differences

PRU-ICSS UART

The PRU-ICSS UART is identical on AM335x and AM57x.

PRU-ICSS eCAP

The PRU-ICSS eCAP is identical on AM335x and AM57x. However, AM57x implements debug suspend for the PRU-ICSS eCAP. To run the PRU-ICSS eCAP during emulation suspend, the ECCTL1 register's FREE_SOFT bit will need to be configured.

PRU-ICSS Industrial Ethernet Peripheral (IEP)

The PRU-ICSS IEP is identical on AM335x and AM572x SR1.1, but backwards compatible on AM335x, AM572x SR2.0, and AM571x.

AM572x SR2.0 and AM571x implement a 64-bit IEP Timer, where the AM335x IEP Timer is 32-bit. The AM572x 2.0 and AM571x IEP Timer also supports more compare registers (16 on AM572x SR2.0 / AM571x vs 8 on AM335x) and adds support for a programmable reset value within the IEP_TMR_CNT_RST register.

Instruction Set and Format Compatibility

The instruction set and format on AM57x is identical with AM335x.




Porting AM335x PRU Software to AM57x

The software changes required to port legacy code from AM335x to AM57x are based on the hardware differences between the two devices. This section details the key differences in software and describes how legacy code can be modified for the AM57x PRU-ICSS. Note additional modifications may be required relating to other SoC differences that are external to the PRU-ICSS. Some of these modifications are discussed in the modifying software for SoC related differences section.

A checklist of changes required for both legacy PRU firmware and ARM code is provided below.

PRU Firmware Checklist
1
PRU addresses within global memory map
2
PRU INTC system event numbers
3
PRU IEP registers
4
PRU constant table values
5
SoC related changes (ie. peripheral addressing or registers, etc.)



ARM Code Checklist
1
PRU addresses within global memory map
2
PRU INTC system event numbers
3
SoC related changes (ie. peripheral addressing or registers, pinmux configuration, ARM Interrupt Controller, etc.)


Updating Global Memory Map References

When porting the legacy software to AM57x, the PRU-ICSS base address will need to be updated in both the PRU firmware and ARM code. Note most PRU firmware code should use the local memory map to reduce latencies and would not require any modification. Only firmware that accesses the global memory map requires updates.

No change is required for any offsets within the PRU-ICSS global memory map.

Configuring PRU INTC system events

AM57xx implements an Interrupt Controller Crossbar that provides flexibility in configuring the INTC system event source. At boot, the PRU INTC can be configured to match the AM335x System Events. This pre-configuration step can be placed in the ARM or PRU code.

Updating PRU IEP Registers

For AM571x and AM572x SR2.0, the IEP Timer register offsets will need to be updated. (The 64-bit IEP Timer feature of these AM57x devices breaks register offset compatibility with AM335x's 32-bit IEP Timer.)

For AM572x SR1.1, no software change is required for the IEP Timer register offsets.

Updating PRU Constant Table References

Differences in the PRU constant table will require changes to PRU firmware code.

The PRU constant table entries are partially backwards compatible, as some peripherals and features maintain the same entry numbers. However, other peripherals and features have been removed, added, or remapped to different entry numbers in the AM57x table.

Refer to the Constant Table Differences section for a comparison between the constant tables on both devices.

Modifying software for SoC related differences

AM335x and AM57x devices have additional differences at the SoC level that also require changes in both PRU firmware and ARM code. Below is a list of some key differences that require code updates. However, this is not an exhaustive list.

Key differences between AM335x and AM57x devices require PRU legacy code updates include:

1. Global device memory map
a. Start addresses of peripherals and features
b. Base addresses of modules
c. Register addresses and offsets
2. Peripherals
a. Refer to Table 1 in section 2 for peripherals supported on each device
b. Peripherals may have new memory or register maps. The functionality of registers may also change.
3. Pinmuxing