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.

PROCESSOR-SDK-AM335X: PRU usage questions

Part Number: PROCESSOR-SDK-AM335X

Hello,

I am studying the AM335x Technical  Reference Manual and I am particularly interested in using the PRU unit from Linux, since I need to perform different tasks based on different real time events (GPIO state changes and UART or SPI).

For example:

GPIOxx input state changes → handle interrupt and perform task from Linux.

UART0 rx buffer is full → handle interrupt and perform task from Linux.

From page 225 I read that PRU-ICSS can handle various interrupts (GPIOs, UART and SPI if I am not wrong)  and at the following link  PRU Linux API Guide example code we have a short demo which shows how to use PRU from Linux. The code loads the binary file PRU_example.bin into the PRU and so waits for the interrupt.

So I have a few questions:

1 ) Suppose I need to handle GPIO and UART (or SPI) interrupts separately . Do I need one program and one binary PRU file (e.g. PRU_example.bin) for each interrupt handling ?

2 ) How to use SPI from PRU ? I don't understand what is the proper section of chapter 4 of AM335x Technical Reference to focus on.

Thank you in advance.

Simon

  • The software team have been notified. They will respond here.
  • Hello,

    Is there any update information about this request ?

    Thank you.

    Simon

  • Sorry about the delay. The person involved is travelling on business and will be back in office mid next week. I will send them a reminder to look at this when they are back.
  • Hello Biser,

    Is there any news about my request ?

    Thank you in advance.

    Regards,

    Simon

  • Simon,

    The API that you referenced is based on an older Linux driver and is no longer supported by TI.

    The currently supported Linux driver for loading a firmware into the PRUs is the RemoteProc driver. Here's a description of the driver: processors.wiki.ti.com/.../PRU-ICSS_Remoteproc_and_RPMsg
    and here's a Quick Start Guide that shows how to run an RPMsg example using the RemoteProc driver: processors.wiki.ti.com/.../RPMsg_Quick_Start_Guide

    The RPMsg example from that Quick Start Guide gives an example of how to use the resource table header file of the PRU firmware in order to have the RemoteProc driver configure your PRU interrupts for you. In the example (which can also be found here: git.ti.com/.../PRU_RPMsg_Echo_Interrupt0), system event 16 is mapped to channel 2 and channel 2 is mapped to host interrupt 2 which gets sent to the ARM core. System event 17 is mapped to channel 0 and channel 0 is mapped to host interrupt 0 which gets sent to the PRU core. The mappings are configured in the resource_table_0.h file and the PRU interrupt mapping is described in section 4.4.2 of the AM335x TRM.

    The list of events that can trigger a PRU interrupt are listed in Table 4-22 of the TRM.

    To answer your questions:
    1) No, you can handle multiple interrupts from a single PRU firmware. You will need to configure the interrupts using the resource table header file and then once the interrupt occurs (either bit 30 or bit 31 of register R31 gets set as described in the TRM) then you can use the PRU INTC SRSR0 and SRSR1 registers to check which interrupt occurred and then handle it.

    2) The PRU has access to the full memory map of the device. This means that you can write a PRU firmware that will read and write directly to the registers of the SPI peripheral in order to control it. However, if you are running Linux on the ARM core then you will need to disable the SPI nodes in your device tree in order to stop Linux from also trying to control the SPI. Since we expect the ARM core and Linux to control the SPI peripheral, we don't provide a PRU example to do the same.

    Jason Reeder