Description
Description of defect
Recently, I've had the "pleasure" of working with a sensor that absolutely requires 0x0 as an SPI fill character (the dummy data sent when doing a read-only transaction). If this is not satisfied, it will throw a fit and reset itself. This led me to the discovery that Mbed's SPI API does not respect the fill character that you set (with SPI::set_default_write_value()
) for asynchronous SPI transactions. Looking into it, I found that STMicro's HAL is hardcoded to use 0xFF for the fill character, but it's not their fault: the data value that is set by SPI::set_default_write_value()
(SPI::_write_fill
) is simply not passed down to the HAL at all for async transfers. So, it has no way of knowing what the user wants for the fill character.
Hopefully, this can be changed in the future so that the fill character is passed down to the HAL (maybe through spi_init()?) and the HAL respects this value. That would make life a lot easier for me!
Target(s) affected by this defect ?
All that implement async SPI. Seen on the NUCLEO_F429ZI.
Toolchain(s) (name and version) displaying this defect ?
GCC_ARM
What version of Mbed-os are you using (tag or sha) ?
mbed-os-6.1.0
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
Not relevant here
How is this defect reproduced ?
- Create an SPI object
- Call
spi.set_default_write_value(0x00)
- Start an asynchronous read using SPI::transfer() with a null transmit buffer
- Observe with a logic analyzer that MOSI is set high during the entire transfer (should be low for zeros)