2017-04-24 8:15 AM
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?
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
Solved! Go to Solution.
2017-04-27 1:44 AM
Thank you
Goossens.Sebastiaan
for sharing your ioc file.I confirm this bug and it will be fixed for the next release.
Thanks
Imen
2017-04-25 4:14 AM
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.
2017-04-25 7:52 AM
Hi
Goossens.Sebastiaan
,I reported this issue internally for further investigation. I will keep you informed about the taken actions/explanation if needed.
ThanksImen
2017-04-26 2:45 AM
Hi
Goossens.Sebastiaan
,Please send me your ioc file?
Thanks
Imen
2017-04-26 3:14 AM
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=false2017-04-27 1:44 AM
Thank you
Goossens.Sebastiaan
for sharing your ioc file.I confirm this bug and it will be fixed for the next release.
Thanks
Imen