cancel
Showing results for 
Search instead for 
Did you mean: 

STM32-MAT Simulink SPI ''Nb_bits_transmission'' bug

sebastiaan goossens
Associate II
Posted on May 01, 2017 at 16:58

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!

0690X00000606uiQAA.png0690X00000606uxQAA.png

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

1 REPLY 1
Imen.D
ST Employee
Posted on May 01, 2017 at 21:14

Hi sebastiaan goossens,

Thank you again for your contribution and sharing this issue.

I will report this internally and come back to you as soon as I have any details/updates.

Thanks

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen