2017-02-13 06:59 AM
Dear STM32 supporters,
I recently updated to V4.4.1 of the MATLAB/Simulink library 'STM32-MAT/Target'. (See also the resolved question at
). I am using MATLAB R2016b.The code generation works fine. But the generated C codes has misktakes:
H-File:
/* ADC1 Regular channel Converted value DMA buffer */
extern uint16_t ADC1_RegularConvertedValue[0];�?�?
An Array with the size of 0 is invalid. I had expected here the value 2 as my model also shows 'Nb of regular channels: 2'.
The code tries to access invalid array elements (each element is invalid):
C-File:
/* ADC1 Regular channel DMA buffer pointer initialization*/
ADC1_DmaBuff = &ADC1_RegularConvertedValue[0];
/* ADC1 Regular channel DMA Half transfer complete buffer pointer initialization*/
ADC1_DmaHalf = &ADC1_RegularConvertedValue[0];
/* ADC1 Regular channel DMA Full transfer complete buffer pointer initialization*/
ADC1_DmaFull = &ADC1_RegularConvertedValue[0/2 - 1];�?�?�?�?�?�?
0/2-1=-1 is also strange!
Can you confirm this?
Is this an issue of MAT/Target V4.4.1?
#stm32-mat/target2017-02-13 08:43 AM
Hello
I have moved your question to the
‌ where someone should be able to assist you.Thanks
Oli
2017-02-14 12:53 AM
Hi @michaeL,
I confirm the bug; this is taken as a priority and will be fixed as soon as possible. We will keep you informed when the new version will be available.
Sorry for such inconvenience.
-Amel
You are an STM32 user and want to express your trust for our products and win a 3D printer? Get your chance participating in
https://community.st.com/community/stm32-community/embedded-world-contest
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2017-02-14 04:09 AM
Hello
oliverbeirne
andst.mcu
,thank you very much for the processing of this request.
I think this issue came up between version 4.4.0 and version 4.4.1.
Best regards,
michaeL
2017-02-15 12:40 AM
Hello,
we are working on this bug.
It happens when ADC DMA buffer size is 0
Workarround can be to set ADC DMA buffer size to a value greater than 2.
Best regards
Pascal
2017-02-15 08:15 AM
Hello
REYNAUD.PASCAL
,this workaround does not solve the problem.With Setting the ADCDMA buffer to 2 or 4 the invalid array definition and access went away. But there was still an inclusion of a file called <ProjectName>_External_Functions.h which was not found in the project folder. I remarked this inclusion and the code compiled.
But my model based design does not work like in earlier versions. Sorry, but I can not use this version at all.
Best regards,
michaeL
2017-02-16 10:24 AM
Hello Michael,
can you please tell me used mode?
Normal, PIL or external mode
Best regards
Pascal
2017-02-16 10:45 AM
Hello Mickael,
<ProjectName>_External_Functions.h should had been generated in <ProjectName>/Inc repository even if you did not select any external file to include from configuration parameters window > Code Generation > STM32 Project Files.
This file should be empty.
Can you please confirm it is not generated at all?
Then, can you please explain the difference for your design regarding previous versions?
Thank you
Best regards
Pascal
2017-02-17 02:29 AM
Hello
REYNAUD.PASCAL
, I am not sure, what you mean with 'normal' or 'external mode'. Referring to page 5 of it is 'Step 3: Everything on STM32'.michaeL
2017-02-17 02:33 AM
I confirm, that I did not find any file *_External_Functions.h.
I did not change my model at all, I only updated from V4.4.0 to V4.4.1. (I also moved to the newer MATLAB/Simulink version R2016b, but this was before).