I'm trying to use the TM4C as a SPI slave which will generate responses to queries/commands issued by a separate master microcontroller. I'm running in SPI mode 1 so that I don't need CS asserted after every byte.
For example, the master would send a frame: [cmd1, dummy] and simultaneously receive [dummy, cmd1_response]. I think this is an extremely common task but the SSI in the TM4C appears to make this very hard in slave mode.
The problem is the 8 byte FIFO cannot be bypassed or disabled and the fact that for slave, there are really only three useful interrupts, but I can't see any combination of them which are really useful here due to the FIFO:
- RX FIFO half full or more: will only trigger after at least 4 bytes are in the fifo. Useless here because that would only trigger by the time the 2nd command frame has been completely sent by Master. Meanwhile the slave has been busy transmitting whatever was in the FIFO, which obviously cannot have any relation to the commands.
- TX FIFO half full or less: it will immediately trigger 4 times before you've even had a chance to receive the first command ????
- RX timeout: also useless because, again, by the time it triggers you have been given no chance to actually read the command; at best you've already received the two bytes and send back two (random) response bytes.
- Also the most potentially useful interrupt, the EOT interrupt, is only available in Master mode!!
Am I missing something here? I suppose it may be possible if you force the command to be four bytes, and always have the slave initially send out 4 wasted/junk bytes at the start of frame, but these constraints seems disastrous when you have no control over the Master's protocol ?