Other Parts Discussed in Thread: HALCOGEN
Hello,
I'm trying to setup MiBSPI in following configuration:
- TMS570 is a slave device on SPI bus, word length is 8-bit
- MiB SPI is configured to use 8 buffers, 0-7, with CS[0] selecting the device
- Each time buffer 7 is written to, DMA copies received content to buffer in SRAM
- Because I don't know the number of bytes transmitted during single CS-active event, I've enabled "Chip Select Hold" in HALCoGen
I'm now testing the case where 16 bytes are transmitted to TMS570 with CS being constantly active during transmission. In this case the RxRAM will receive 8 bytes in 8 buffers, DMA will be triggered once, and the rest of traffic is lost.
I've inspected the code generated by HALCoGen (v04.05.02) and found following line for buffer 7:
mibspiRAM3->tx[i].control = (uint16)((uint16)4U << 13U) /* buffer mode */ | (uint16)((uint16)0U << 12U) /* chip select hold must be zero for last buffer */
When I manually change CS_HOLD to 1 for buffer 7, I get the expected behavior - two DMA triggers and all of sent data being copied to SRAM.
Why is CS_HOLD set to 0 in generated code? Why does comment say "chip select hold must be zero for last buffer"?
Thanks
Josip