This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM623: Brainstorming PRU software UART limitations

Part Number: AM623

Hi PRU team,

An old friend at a customer reached out asking if we could do a 1.5mbps UART and how many we could do with the 2 PRU IP's in an AM62x architecture.  He needs more than the hardware UARTs on the AM62 and is trying to replace an FPGA that is expensive but gave a huge # of UARTs.  I had an email exchange with Nick.  I'll copy it here and then we can loop in the customer for this great discussion:

Initial thoughts:

Need more details about usecase:

    • Half duplex or full duplex
    • If half duplex, is this TX or RX
    • Where is the data coming from and where is it going
    • Whether the data needs any pre-processing before passing to another core

There is not an existing project that does this that a customer would be able to copy/paste, so the customer would need to do some development work.

 

Design overview

There are 4 options I am aware of for PRU UART on AM62x:

    • Hardware UART in the rest of the processor (8 on AM62x)
    • Hardware UART in the PRU subsystem (1)
    • SW UART implemented through 3 channel peripheral interface (up to 3 half-duplex instances per PRU core, or 3 full-duplex instances across both PRU cores)
    • SW UART implemented by bitbanging (cannot say exact limits right now)

 

For HW UART in the rest of the processor, read / write latencies may be a limiting factor at higher speeds. Interrupt driven would be better than polling if an option (I haven’t checked interrupt mapping).

 

For SW UART implementations, the time between when we need to read/write data to the interface is the limiting factor. 3 channel peripheral interface is a bit more forgiving since you load the bits you want to send or read into a FIFO, so you have either 8 or 16 bits on the UART line before you need the code to circle back and service that particular UART instance. Bitbanging data by directly reading/writing the GPI/GPO pins can theoretically go much faster than 3 channel peripheral interface (3 channel peripheral interface maxes at 16MHz), but your code also has much less time to execute since you need to do that GPI/GPO read/write for every single bit on the UART line. AM64x is a lot more flexible than AM62x in implementing bitbanging code, since you have 3x the PRU cores to do processing within the same amount of time, and 2x the PRU subsystems.

 

If the customer’s request was 12-15 UARTs running at 115200 Baud, then my answer would be: yes, this is very easy. We just port the AM335x SoftUART Linux driver & PRU firmware to AM62x, which gives up to 6 additional UARTs. This code was written for a 200MHz PRU core, not a 333MHz PRU core, so if the customer needed even more UARTs, we could pretty easily sneak in another 2 UARTs, maybe more: https://software-dl.ti.com/processor-sdk-linux/esd/docs/07_03_00_005/linux/Foundational_Components/PRU-ICSS/Linux_Drivers/pru-sw-uart.html

 

Another question to ask is whether PRU even needs to be in the loop. If software development is needed anyway, does it make sense to do that software development on Linux drivers than in PRU firmware? For example, DMA might be able to help offload frequent reads & writes even if PRU isn’t used. In the UART case, I think the Linux UART driver doesn’t have DMA support upstreamed at this point in time though. Bin would know more about that thought process.

  • Thanks Blake,

    I just want to know how many uarts can we create using 2x PRUSS. We need them to run at 1.5Mbps. They will be half duplex. So they will only transmit or receive at one time never both at the same time. My message sizes are mostly fixed (16 bytes) but some devices will negotiate to larger message sizes (up to 64bytes). 

    I appreciate the help. Let me know if you need any further details.  

  • Hi Levi, 

    So from our offline correspondence, you needed ideally 21 total right?  And you are counting 9 on the chip leaving you 6 and 6 you would need to create on the PRU's ideally. 

    I think you could do a near infinite amount of UARTS @ 300 baud - it is going to be the 1.5Mbps that gets us :)

    Nick - what do you think?

    Blake

  • Another option is to use the two AM62x USB interfaces and add USB-UART chips on the board attaching to the USB interfaces with USB hubs. I am not sure how much will be added to the BOM cost, but the advantage of this solution is that it merely requires any software development, all the common USB-UART chips already have drivers supported in the Linux kernel.

  • Great Idea Bin!  I hadn't thought of that one.

    Blake

  • Hi,

    The thread owner is out of office till until week of Feb 17. Please ping the thread if you do not get an update during that week.

    Thank you for your patience.

    Regards,
    Harshith

  • I think you could do a near infinite amount of UARTS @ 300 baud - it is going to be the 1.5Mbps that gets us :)

    Nick - what do you think?

    3 channel peripheral interface can do up to 3 half duplex UARTs per PRU up to 8-10Mbps. So, 6 or 7 (include HW PRU UART) possible depending on pinmux (AM62 has some restrictions in this context)