2023-09-05 01:41 AM - edited 2023-09-05 02:09 AM
Hello,
I am using X-CUBE-SPN5 with F030R8 and IHM05A1 to control a stepper motor and it works well.
I would now like to use UART with provided driver (stm32f0xx_hal_uart).
Hence, I enabled UART use in stm32f0xx_hal_conf.h.
To test UART integration, I am using a piece of code generated by ST IDE in another application only dedicated to print a string in a putty terminal with HAL_UART_Transmit (this dedidated application works well).
But integration of this code no longer permits to see the string in putty, whereas the code compiles and executes well, there is nothing visible in putty.
Config. with only one USB cable between the PC and the STM32, and putty looking to the STLink Virtual COM Port.
The main is given below, with bold caracters for UART related lines :
2023-09-05 01:53 AM
Hello @user-stm
I suggest you to verify your putty configuration. Else make sure that the gpio configuration for the USART is fine.
Best regards.
II
2023-09-05 01:55 AM
No problem about putty configuration, as the bold lines of the code are the ones used in the application only dedicated to print the string in putty, application that has been tested and works well.
2023-09-05 02:03 AM
Well, if you use an STM32F302R8, you should not edit stm32f0xx_hal_conf.h, but stm32f3xx_hal_conf.h.
By the way, you can also insert source code here as such by clicking the three dots in the text box at the top right and starting the function with </>.
Regards
/Peter
2023-09-05 02:09 AM
Mistake, I am using F030R8, that is why I have edited stm32f0xx_hal_conf.h.
Otherwise, if that can be helpful, reminds that the code compiles and executes well, while there is anything in putty ... and putty parameters are matching Tx parameters as I has been tested in the dedicated appplication.
2023-09-05 02:40 AM
what is a bit strange is that you are using ButtonHandler() that contains a HAL_Delay() function but IMHO this function is not called from main(). So then it must be called from an ISR and then HAL_Delay() is not the right way to go if you are activating from an ISR based context.
In order to find the origin of your problem: combine both codes, comment out the part of the motor and then activate it step by step. Sooner or later you will find the culprit.
2023-09-05 04:39 AM
The ButtonHandler function comes from the initial main() of SPN5 dedicated to the stepper motor control.
The presented main() is indeed not calling it precisely because I am for now only trying to integrate the UART part, by getting the string in the putty terminal.