cancel
Showing results for 
Search instead for 
Did you mean: 

MX vs IDE possible conflicts using HAL

zachariasfct
Associate

When using MX to generate the ioc-file and then importing it to CubeIDE, it is tricky to make it work.

Such as trying to make a pin an output pin. In this case on the STM32H563 where I want to use PE2 (on pin 1) and PE3 (on pin2) as output pins. when generated it is not possible to change the output of these port pins. Why is that a problem when the compilation is ok and the debuger does not protest?

Is there any specific setup that has to be done manually? Iried that but then the compiler objected.

How make such a simple action work in such a complicated environment?

 

 

5 REPLIES 5
Andrew Neil
Super User

Welcome to the forum.

Please see How to write your question to maximize your chances to find a solution for best results.

 

You haven't said what versions of IDE & MX you're using, or on what Host platform.

Also what Target board, and the full STM32 part number.

 


@zachariasfct wrote:

I want to use PE2 (on pin 1) and PE3 (on pin2) as output pins. when generated it is not possible to change the output of these port pins.


I'm not sure what you mean here?

Do you mean when you do this:

HAL_GPIO_WritePin( GPIOE, GPIO_Pin_2, GPIO_PIN_SET   ); // PE2 high

HAL_GPIO_WritePin( GPIOE, GPIO_Pin_2, GPIO_PIN_RESET ); // PE2 low

You don't see the physical output level changing state?

 

Please post a minimum but complete project which illustrates this. Include the .ioc file.

You can attach a zip file, or see How to insert source code for how to put C code into a post (as above)

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
Super User

You click the pins you want to make output to select them as output. I don't know how they could possibly make it any easier. Why can't you change them?

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

Please see the following files if you find errors that I've missed.

Rgds

zacharias

 

You still haven't clearly stated what problem(s) you are seeing.

You still haven't said what versions of IDE & MX you're using, or on what Host platform.

Also what Target board, and the full STM32 part number.

 

Again, you can attach your project as a zip file, or see How to insert source code for how to put C code into a post (as above) - not as a .docx !

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@zachariasfct 

As @Andrew Neil mentions, follow the link which shows how to insert source code instead of making a docx file. That way it shows as properly formatted code.

As for the PE2 and PE3 pins, your code shows you're using GPIOA, not GPIOE. You've renamed the pins to CLK and SEL, so you should look at the main.h file. CubeMX generates the custom define names which you can use instead of the generic port pin names. 

In you case it'll probably look like this

// main.h
#define CLK_Pin GPIO_PIN_2
#define CLK_GPIO_Port GPIOE
#define SEL_Pin GPIO_PIN_3
#define SEL_GPIO_Port GPIOE

HAL_GPIO_TogglePin(CLK_GPIO_Port, CLK_Pin);
HAL_GPIO_TogglePin(SEL_GPIO_Port, SEL_Pin);

  

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.
CAN Jammer an open source CAN bus hacking tool
CANableV3 Open Source