cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Simulink target Blockset

thomasimdieke9
Associate
Posted on February 25, 2016 at 14:16

Hello,

on my university we try to programm a STM32F072RB Dicovery Board with simulink embedded coder. But we've got some Problems. Every time we try to use the ADC-Block

an error accure: ''Selected ADC has not been configured''. But it is configured in the cubeMX. Maybe someone has allready fix this issue.

The CubeMX version is 4.13.0

The STM32F0 Lib. is version 1.5.0

Best regards

T.I.

#simulink-st32-mat-matlab-2015a #simulink-code-generate
5 REPLIES 5
Posted on February 26, 2016 at 08:48

Hi Thomas,

ioc file including configured ADC must be selected from STM32_Config model.

Then, ADC must be selected from ADC_Read block even if you have configured one ADC only.

Please download STM32-MAT/TARGET V4.3.0, some modifications have been done regarding ADC.

Best regards

Pascal

thomasimdieke9
Associate
Posted on February 26, 2016 at 14:57

Hello mr Pascal,

that's exacly what I've tried. I drag the MCU Config block into the Simulink Model and

selected the ioc file. But if I try to drag the ADC-Read block into the model the error appears. When I open the Blockmask I'am not able to select any channel of the ADC.

I think the Problem is in the ioc file. In my created File for the STM32F072RB :

#MicroXplorer Configuration settings - do not modify

File.Version=6

KeepUserPlacement=true

Mcu.Family=STM32F0

Mcu.IP0=ADC

Mcu.IP1=NVIC

Mcu.IP2=RCC

Mcu.IP3=SYS

Mcu.IPNb=4

Mcu.Name=STM32F072R(8-B)Tx

Mcu.Package=LQFP64

Mcu.Pin0=PA0

Mcu.Pin1=VP_SYS_VS_Systick

Mcu.PinsNb=2

Mcu.UserConstants=

Mcu.UserName=STM32F072RBTx

MxCube.Version=4.13.0

MxDb.Version=DB.4.0.130

NVIC.SysTick_IRQn=true\:0\:0\:false

PA0.Locked=true

PA0.Mode=IN0

PA0.Signal=ADC_IN0

PCC.Checker=false

PCC.Line=STM32F0x2

PCC.MCU=STM32F072R(8-B)Tx

...

There are only two lines which has informations of the ADC.

In the ioc file of the examples for the STM32F407V (F4VGTx_OneADC.ioc)

are much more configuration lines:

#MicroXplorer Configuration settings - do not modify

ADC1.Channel-5\#ChannelRegularConversion=ADC_CHANNEL_0

ADC1.ContinuousConvMode=ENABLE

ADC1.DMAContinuousRequests=ENABLE

ADC1.EOCSelection=EOC_SEQ_CONV

ADC1.IPParameters=Channel5\#ChannelRegularConversion,EOCSelection,SamplingTe5\#ChannelRegularConversion,master,ContinuousConvMode,InjNumberOfConversion,Rank-5\#ChannelRegularConversion,ScanConvMode,DMAContinuousRequests

ADC1.InjNumberOfConversion=0

ADC1.Rank-5\#ChannelRegularConversion=1

ADC1.SamplingTime-5\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES

ADC1.ScanConvMode=ENABLE

ADC1.master=1

So maybe this can be the reason why the ADC-Read block can't read the configuration.

I have also downloaded the newest version of the blockset as you say. But it is the same error.

best regards

Thomas Imdieke

durgaselva83
Associate
Posted on October 05, 2016 at 08:41

Hello Pascal,

I have downloaded the lattest version of STM32-mat V4.4.0.using Matlab 2015b 32 bit.

After all configuration steps done for ADC as you mentioned, I get the following error as:

''ADC s-function parameters list  does not match the parameter list in the Mask''.

is it a problem with the compiled mex file or am I doing something wrong?

slimen
Senior
Posted on October 05, 2016 at 11:47

Hello

I think this is due to the configuration parameters and setting

within MATLAB environment

.

Have a look to themathworks site to have more info aboutconfiguration of

https://www.mathworks.com/help/simulink/ug/parameter-arguments-in-matlab-function-block-functions.html

and

https://www.mathworks.com/help/simulink/slref/mask-parameters.html

.

I recommend you to follow the displayed instructions inthe attached document ''STM32 MAT-TARGET HandsOn''

Regards

________________

Attachments :

STM32_MAT-TARGET_HandsOn_v1_0.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htoq&d=%2Fa%2F0X0000000aXE%2F7DLPRJoilPm2pEkEG3gJk3EhO.syqLanQhorW4BAcr4&asPdf=false
Posted on June 12, 2018 at 11:30

 ,

 ,

Hi,

Im experiencing the same problem only one port per ADC channel appears in the Simulink ADC block. I have found that its related to this line in the .ioc file:

ADCx.Channel-4\ ♯ ChannelRegularConversion=ADC_CHANNEL_x

There is only one such line per ,ADC channel even if multiple ports are selected, if I copy that line and change the port number it can now be read in Simulink. But this change is of course removed by Cube when project is saved.

Can you resolve this issue?

MathLab 2017b

STM32-MAT 4.4.2

STM32CubeMX 4.26.0

/Jonatan