cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX , how to live with it

AKozarzewski
Associate II

I'm trying to set configuration for STM32WL55JC but I have no luck at all. I have set some pins, namely inputs: PB1,PC6,PC13, outputs: PB10,11,15, pc3,4,5, but the problem is all the time, I'm trying to not to touch almost anything wht is not needed:

-if gpio.c is generated, then it has no entries except basic resonator , nothing else in it

-gpio.c is not created at all

-looks like gpio.c is created on the first try only, then you apparently have to delete project completely to have again chance to have it done by a tiny bit, but one false step and no configuration at all, and you can start over

Any suggestions? It looks really hopeless

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

> PB1,PC6,PC13, outputs: PB10,11,15, pc3,4,5,

PB1 is not set to any function, so no initialization.

0693W00000FD4nmQAD.png 

PC6 is not initialized since it's not assigned to either core. You need to assign it to the M4 or the M0+ core, in which case it will include the initialization code in that core's project. Right click the pin to get this menu.

0693W00000FD4mtQAD.pngPC13 is not set to any function.

Same for PB10.

PB11 isn't assigned to a core. I'm guessing the rest are either not assigned a function or not assigned to a core.

CubeMX should really be warning you here at the very least during code generation that pins are assigned functions but not assigned to any cores. But it is still workable. Expect dual core development to be more finicky and time consuming in general than single core projects.

The warning for RCC means you can't enable certain things in that peripheral because pins are being used by other things. It does not mean there is an active conflict that needs fixed. CubeMX could be better about how it presents this information.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

6 REPLIES 6
TDK
Guru

> the problem is all the time, I'm trying to not to touch almost anything wht is not needed

I'm not quite sure what this means. If you set some pins as input, and some others as output, and hit generate code, it should generate the code. What Toolchain/IDE are you using?

Perhaps share the IOC file that gives you unsatisfactory results.

> if gpio.c is generated...

gpio.c is only generated if you have "Generate peripheral initialization as pair of..." checked under Code Generator options.

If you feel a post has answered your question, please click "Accept as Solution".
AKozarzewski
Associate II

OK, I found out that my board is compatible 1:1 with Nucleo with STM32WL55JC, simply click that MCU and there are two boards, choose that first one. So I've used exactly that template. It still doesn't generate proper configuration, only this:

static void MX_GPIO_Init(void)

{

 /* GPIO Ports Clock Enable */

 __HAL_RCC_GPIOA_CLK_ENABLE();

 __HAL_RCC_GPIOC_CLK_ENABLE();

 __HAL_RCC_GPIOB_CLK_ENABLE();

}

No matter if I choose separate files or inserted into main. I don't change anything , since these settings are optimal already. Can you please check it on your environment?

There are some false warnings in RCC ,I believe, but despite that no matter what is chosen, configuration ends like that

If you include your IOC file, I will take a look.

If you feel a post has answered your question, please click "Accept as Solution".
AKozarzewski
Associate II

In attachment, you can make such file like I said before

TDK
Guru

> PB1,PC6,PC13, outputs: PB10,11,15, pc3,4,5,

PB1 is not set to any function, so no initialization.

0693W00000FD4nmQAD.png 

PC6 is not initialized since it's not assigned to either core. You need to assign it to the M4 or the M0+ core, in which case it will include the initialization code in that core's project. Right click the pin to get this menu.

0693W00000FD4mtQAD.pngPC13 is not set to any function.

Same for PB10.

PB11 isn't assigned to a core. I'm guessing the rest are either not assigned a function or not assigned to a core.

CubeMX should really be warning you here at the very least during code generation that pins are assigned functions but not assigned to any cores. But it is still workable. Expect dual core development to be more finicky and time consuming in general than single core projects.

The warning for RCC means you can't enable certain things in that peripheral because pins are being used by other things. It does not mean there is an active conflict that needs fixed. CubeMX could be better about how it presents this information.

If you feel a post has answered your question, please click "Accept as Solution".
AKozarzewski
Associate II

Many thanks!! Now I understand, probably when I checked some other pins earlier that didn't need an assignment, then it worked in some cases, somehow. I agree, some more warnings should be there. There was an option in table "Pin context assignment" in earlier versions and now you have to right click on pins. Anyway many thanks.