Skip to main content
sebastiaan goossens
Associate II
April 24, 2017
Solved

STM32-MAT Simulink SPI ''Type_SPI'' bug

  • April 24, 2017
  • 5 replies
  • 1420 views
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

    This topic has been closed for replies.
    Best answer by Imen.D
    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

    5 replies

    sebastiaan goossens
    Associate II
    April 25, 2017
    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.

    ST Technical Moderator
    April 25, 2017
    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

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
    Imen.DBest answer
    ST Technical Moderator
    April 27, 2017
    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

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks