STM32-MAT Simulink SPI ''Nb_bits_transmission'' bug
- May 1, 2017
- 1 reply
- 608 views
The following issue was encountered when using a stm32nucleo board (nucleo-f302r8) in combination with Simulink to test the sending of some spi frames: The amount of bits sent per frame was less then what Simulink indicates.
What happened is that CubeMX defaults the data size of the spi frame to 4 bits for the f302r8 chip. (8 bits seems much more logical as a default to me, but that has nothing to do with the problem itself).
Simulink however will display everything between 4 and 15 bits as 8-bit, where 16-bits is correctly displayed as 16-bit. (see images below).
This resulted in non functional spi frames where Simulink showed nothing wrong. I needed to check the signal on an oscilloscope to find out the source of the problem.
I attached the .ioc file where the problem showed. The problem probably caused by the fact that most chips only have an 8-bit and 16-bit operating mode for spi.
Can this problem be fixed? It is not really a huge issue for me personally anymore because I use 8-bit spi mode, but it was an inconvenience to figure out.
Thanks!


Application versions:
Matlab r2016b (with all the required toolboxes)
STM32CubeMX 4.20.1 with STM32F3 package 1.8.0
STM32-MAT_TARGET 4.4.1
