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.

RTOS/AM5728: SPI interrupt mode usage from PRU

Part Number: AM5728


Tool/software: TI-RTOS

Hello Jason, I managed to use SPI (polling Mode )through PRU ^_^.But I wonder how to use Interrrupt mode.

1)Should I remap the SPI_IRQ  to PRU ,and how ?

2)I have read your answer here, why "16" represent PRU_to_ARM interrupt? 

https://e2e.ti.com/support/arm/sitara_arm/f/791/t/630504?PROCESSOR-SDK-AM335X-PRU-usage-questions

  • The RTOS team have been notified. They will respond here.
  • Hi,

    1) McSPI0 interrupt is mapped PRU-ICSS (McSPI0INT), see TRM Table 24-2. McSPI Connectivity Attributes, and event number 44 in Table 4-22. PRU-ICSS System Events, so you can follow the typical PRU interrupt handling to process the SPI interrupt. "The PRU-ICSS contains an interrupt controller that can map 64 system events down to two flags that are set in a PRU core register (bits 30 and 31 in core register R31). The PRU core can then check each of these flags in a single cycle to see if an event has occurred. These flags can either be polled upon or
    checked periodically"

    2) System event number 16 is in line with Linux device tree as commented in the code, you may choose other event number from pr1_pru_mst_intr[x]_intr_req as long as it's not used and align with device tree.

    Regards,
    Garrett
  • Hello Garrett,

    thanks for the quick reply,

    But what you mention is am335 TRM,I am using am5728.

    Here is what came up to me(base on TRM_am5728) :

    1)According to Table 18-14, write 0x3D (mcspi2  IRQ CROSSBAR number is 61)to  register "CTRL_CORE_PRUSS1_IRQ_42_43",

    through  this way  map mcspi2 IRQ to PRU-ICSS1_IRQ_43

    2)set PRU system interrupt 43( to channel 1, and then map channel 1 to host interrupt 1.

    Finally detect mcspi2 IRQ from __R31.

    Is that right?

  • Hi philos,

    Yes, the mcspi2 interrupt mapping to PRU looks correct to me.

    Regards,
    Garrett