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.

TMS570LC4357 SPI SLAVE FUNCTION question.

Other Parts Discussed in Thread: TMS570LC4357, HALCOGEN

I want to realize the TMS570LC4357 spi slave interrupt function to receive data which sent by other MCU, but i met many problems like below list.

1. Why there isn't RXFUL interrupt after 'spiGetData' initialization and the MOSI has data according captured signal wave? 

2. I adopted 'spiSendAndGetData' to initialize spi,but spi does not  work as expected as below description.

The spi host sent “0xAA0xBB0xCC0xDD0xEE0xFF0x000x11”,but data received byTMS570 spi slave is “0xAA0x000xBB0x000xCC0x000xDD0x00”.

And if any one can share sample codes about spi slave receive interrupt function demo to me?

Thanks

zyn

  • Zyn,Is your SPI master sending 8 bits of data or 16 bits?
    To me "The spi host sent “0xAA0xBB0xCC0xDD0xEE0xFF0x000x11”,but data received byTMS570 spi slave is “0xAA0x000xBB0x000xCC0x000xDD0x00" just looks like what you would expect if 8 bits of data is shifted into the 16-bit shift register.
  • Zyn,

    I've attached an example that you can use to understand SPI with interrupt.
    This code is a little more complex, so let me explain.


    MIBSPI1 is used to send data to SPI4 (external connections have to be made)
    MIBSPI1 is using DMA to transfer DATA from RAM to MIBSPI RAM for transmit.
    SPI4 receives the DATA and interrupt is used to read the incoming data and move to RAM
    SPI4 sends DATA to MIBSPI1 (also using interrupt)
    MIBSPI1 after reception uses DMA to move DATA from MIBSPI RAM to RAM.

    So you can focus on the SPI4 code to see how interrupts are managed.

    Also the corresponding Halcogen project is provided.

    Have a look and let me know if this is helpful.

    8836.TMS570LS1224_MIPSPI1_SPI4_DMA.zip

  • Hi Anthony,

    Thanks for your hint!The received datas changes.But  i met another problem.

    After the tms570LC4357  received  2 packet,there were no interrupts genetated any more.And the first packet was not received completely.The last two bytes were not received.I thought it was relative with transmit interrupt.How to configure the SPI (Compatibility SPI mode)to just enable the receive interrupt?

    Thank you!

    regards,

    Zyn

  • Hi ,Thanks for share the example!
    I tried to understand the example,but it is realy too complex for me to understand.I never learned about the MIBSPI.
    I 'd like to use the SPI in Compatibility SPI mode at present.Is there an example in Compatibility SPI mode?
    Thanks!Regards,Zyn
  • Good morning, I see that you have some issues to work with the SPI bus, then I present an alternative solution; I was working a pirate SPI bus, quite simple functions.
    the data transfer speed depends largely on the version of Hercules you have.
    The example is for a memory SPI 25LC256 from Microchip, working properly, sending him the code and I wonder if you could successfully implement it.

    BTW: see the pin configuration in HalCoGen!!!

    2844.RM46_SPI.rar

    Regards
    Martin A. Valencia

  •  

    Thank you!

    I will try it later.

    Regards

    zyn