I'm implementing a driver for an ASIC that exchanges a lot of data. There's a 2-byte address to be written, then data is exchanged. The requirement for receiving data is that the MOSI data is zero until the last byte is read; this is called the 'termination byte' and should be 0xFF.
The SPI_DI signal (MOSI) is used for termination of the read access by the SPI master. For the last
data byte, the SPI master has to set SPI_DI to high (Read Termination byte = 0xFF), so the slave will
not prefetch the next read data internally. If SPI_DI is low during a data byte transfer, at least one
more byte will be read by the master afterwards.
Unfortunately 'SpiReceive()' sends 0xFF by default for SpiReceive. I have now changed this in spi_lld.c for my architecture (STM32), but I don't like messing around in the LLD drivers, code portability becomes impossible that way.
I'd like to request a feature that makes it possible to override the default value of the dummytx byte, maybe in halconf.h? This way the code would be portable. Otherwise, I'd have to use SpiExchange and reserve memory for the largest message that I expect to receive (I feel a bug coming...) and fill that with my preferred MOSI character.
If you see another solution to make my code portable: I'm all ears.