2018-02-25 07:19 PM
Environment:
Windows10 (x64)
Matlab R2017a
STM32-MAT/TARGET-v4.4.2
STM32CubeMX-v4.24.0
STM32Cube MCU Package for STM32F0 Series -v1.9.0
SW4STM32-v2.4
TrueSTUDIO-v9.0.0
The STM32F030CC has 6 USARTs. USART1 and USART2 have separate interrupts. USART from 3 to 6 have one common interrupt. Apparently, STM32-MAT/TARGET searches for individual interrupts for each USART, because the code generated for USART1 and USART2 works correctly (via interrupts), but for USART3-USART6, STM32-MAT/TARGET generates the code as if they were working without interrupts, in polling mode (HAL_UART_Receive function). At the same time, the interrupt handler for USART3_6 is generated by the ''Cube'', but is not used during operation. It turns out completely incorrect work of the code.
That is, STM32-MAT/TARGET does not accept USART with common interrupts as working on interrupts. This is even seen in the Simulink USART blocks - Interrupt checkbox is unfilled for USART3 - USART6.
Here we use interrupts in Cube:
STM32-MAT/TARGET does not perceive them:
Bypass
1.
Add the following lines to the file *.ioc:
NVIC.USART3_IRQn=true\:0\:0\:false\:false\:true\:true
NVIC.USART4_IRQn=true\:0\:0\:false\:false\:true\:true
NVIC.USART5_IRQn=true\:0\:0\:false\:false\:true\:true
NVIC.USART6_IRQn=true\:0\:0\:false\:false\:true\:true
In Simulink blocks the Interrupt checkbox will be filled:
2. Save the file and change its properties to ''Read only'', because the code generator tries to overwrite the file with the original one and removes added lines. The code generator will curses (just click OK), but the process will be successful.
#simulink #stm32-mat/target-matlabSolved! Go to Solution.
2018-02-26 11:42 PM
Hi,Dima
The bug is fixed.
Please following this i
nstruction:
1. Replace (Overwrite) the following files in to STM32-MAT/TARGET installation path: \MATLAB\STM32-MAT\STM32\blks\masks 1.1 USART_Receive_callback.p 1.2 USART_Send_callback.pBest regards,
________________ Attachments : patch_USART_block_update1.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hxvu&d=%2Fa%2F0X0000000b2P%2FJ_LvSz.L2FBN4apuhe.3FUyGuJ5wA7UCO5lHIuT5kBI&asPdf=false2018-02-26 11:42 PM
Hi,Dima
The bug is fixed.
Please following this i
nstruction:
1. Replace (Overwrite) the following files in to STM32-MAT/TARGET installation path: \MATLAB\STM32-MAT\STM32\blks\masks 1.1 USART_Receive_callback.p 1.2 USART_Send_callback.pBest regards,
________________ Attachments : patch_USART_block_update1.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hxvu&d=%2Fa%2F0X0000000b2P%2FJ_LvSz.L2FBN4apuhe.3FUyGuJ5wA7UCO5lHIuT5kBI&asPdf=false2018-02-27 04:58 AM
Hi!...
Promptly! )))
Thank you!