In the spi_api.h header, the master transfer cannot support a default fill value that holds a value larger than an 8 bit value because it is a char.
This can lead to issues where a value beyond 8 bits will not be sent correctly as a fill character.
This is possibly not an issue if you always send the same number of words as received (or you go to that trouble yourself) but it does lead to an inconsistency with how the drivers are called from the C++ level down to the vendor code.
Here is the function declaration (found here):
int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, char write_fill);
As you can see, there is no way to send out a larger value.
To be fair, I do not know if this is a true problem. I ran into this when working on a PR to add support for SPI words that are not modulo-8 in size to the ST drivers. As far as I can tell, only the first 8 bits would be sent in how this operates if you send out a 9 or more bit number.
My solution, if this would actually not break things, would be to change the type of the
write_fill parameter to a
uint32_t. I believe this is possible without being a breaking change since
write_fill is the last in the parameter list. This would allow the vendor implementation to truncate the default fill parameter as appropriate.