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.

TMS570LS3137: SPI and IRQ

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Hello,

TMS570 is SPI master and different chip act as SPI slave. Based on available examples I wrote simple app and am able to send requests and receive answers. 
Now I would like to add some more functionality e.g. extra CAN communication, GPIOs etc. 

and the question is, how TMS570 will behave when any interrupt comes (e.g. from new CAN message or GPIO) during SPI transmission? I am using spiTransmitData() and spiTransmitAndReceiveData functions generated by HalCoGen. Should be used _disable_IRQ() before and _enable_IRQ() after sending bytes over SPI?

Thank you.

  • Hello,

    Both spiTransmitData() and spiTransmitAndReceiveData use polling mode to transmit and receive SPI data. You don't need to disable the IRQ interrupt.

    The spiSendData() and spiSendAndGetData() are the functions to transmit and get SPI data using interrupt mode. By default, the MibSPI1 has lower priority than GIO, and higher priority than CAN1. When those three interrupts happen simultaneously, the VIM will prioritize the received interrupts based upon a programmed prioritization scheme (VIM table: GIO Level1 is channel 9, MibSPI1 is channel 12, and CAN1 is channel 16). The VIM will send the lowest numbered active channel (channel 9) to the CPU. So GIO interrupt will be handled first, then MibSPI1, then CAN1.

    When transmitting or receiving SPI data in interrupt mode, after entering the ISR, the IRQ is disabled automatically. The comping GIO interrupt and CAN interrupt will not interrupt SPI transmission.
  • QJ Wang, thank you.
    To be sure I understand correctly,
    When transmitting or receiving SPI data in INTERRUPT MODE, any other interrupts will not interrupt SPI transmission.

    When transmitting or receiving SPI data in POOLING MODE, any other interrupts will interrupt SPI transmission for a while (and after IRQ was handled the transmission is being continued). Anyway, there is no need to disable IRQ interrupt.

    Could you confirm, please?

  • You are correct.