cancel
Showing results for 
Search instead for 
Did you mean: 

STM32-MAT Simulink SPI ''Type_SPI'' bug

sebastiaan goossens
Associate II
Posted on April 24, 2017 at 17:15

I was trying to get Simulink to communicate to a sensor using SPI, but I encountered the following issue:

When opening the parameter screen of the SPI block by double clicking on it, the ''Type_SPI'' field contains ''No_Configuration_Type'' instead of ''Full_duplex''. This does not happen with any of the three other modes for this field (Half_Duplex, Receive_Only and Transmit_Only).

Due to this bug it is not possible to configure the SPI peripheral as full duplex.

This happens in all SPI ports.

This specifically has to do with the ''SPI1.Direction=SPI_DIRECTION_1LINE'' rule of the .ioc file.

If this value is set to SPI_DIRECTION_2LINES (as required for full duplex config), simulink will parse it as any other invalid value. The SPI_DIRECTION_1LINE value will be parsed correctly as half duplex.

This seems like a bug in the processing of the .ioc file, any ideas?

0690X00000606q3QAA.png 0690X00000606UhQAI.png

Application versions:

Matlab r2016b (with all the required toolboxes)

STM32CubeMX 4.20.1 with STM32F4 package 1.16.0

SW4STM32 v1.14.0

STM32-MAT_TARGET 4.4.1

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee
Posted on April 27, 2017 at 10:44

Thank you

Goossens.Sebastiaan

for sharing your ioc file.

I confirm this bug and it will be fixed for the next release.

Thanks

Imen

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

View solution in original post

5 REPLIES 5
sebastiaan goossens
Associate II
Posted on April 25, 2017 at 13:14

I compared my .ioc file to the one in the 'STM32-MAT\STM32\STM32demos\Test\SPI' example and it seems that deleting the line 'SPI1.Direction=SPI_DIRECTION_2LINES' from the .ioc file fixes the problem en lets matlab recognize the SPI device as full duplex master.

Can this be fixed in a new STM32-MAT version? Doing this manually with each configuration change is not really ideal.

Posted on April 25, 2017 at 14:52

Hi

Goossens.Sebastiaan

,

I reported this issue internally for further investigation. I will keep you informed about the taken actions/explanation if needed.

Thanks

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on April 26, 2017 at 09:45

Hi

Goossens.Sebastiaan

,

Please send me your ioc file?

Thanks

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on April 26, 2017 at 10:14

Hi Imen,

Here is the ioc file. It is just a simple test using only SPI1 with internal clock.

Regards,

Sebastiaan

________________

Attachments :

test.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyhP&d=%2Fa%2F0X0000000bB8%2FS_tdYOitmKyIvShV00sEQwPWyZXp6Vxd17k1bCHFc6U&asPdf=false
Imen.D
ST Employee
Posted on April 27, 2017 at 10:44

Thank you

Goossens.Sebastiaan

for sharing your ioc file.

I confirm this bug and it will be fixed for the next release.

Thanks

Imen

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