cancel
Showing results for 
Search instead for 
Did you mean: 

Configurate uart without using stmcubeMx

TGill.4
Associate II

I am currently working on a project to program a PLC. This one already has a program to control its operation. We are using the Nucleo board STM32F302RBT6. The goal is to extend the program to be able to integrate the uart communication. Unfortunately I can't configure the uart using the normal method on stmcubeMx because it would already damage the current control program. For the configuration I have chosen another method, that of copying all the lines of codes of configuration of the uart in my current program. In the files main.c, stm32f3xx_hal_msp.c and  stm32f3xx_hal_conf.h I added all the necessary configurations as they appear in the uart configuration with stmcubeMx. In addition I added the stm32f3xx_hal_uart.c, stm32f3xx_hal_uart_ex.c, stm32f3xx_ll_usart.h, stm32f3xx_hal_uart.h,  stm32f3xx_hal_uart_ex.h files in the drivers where they belong. Unfortunately the uart communication still does not work and when I compile my program I get the following error: Break at address "0xfffffffe" with no debug information available, or outside of program code.

would someone have some ideas or a method to help me to solve this problem?

1 ACCEPTED SOLUTION

Accepted Solutions
TGill.4
Associate II

I tried several things and I realized that the uart configurations should be added to a separate .c file instead of trying to copy them to the main or elsewhere. This way it's easier and it works without problems.

View solution in original post

3 REPLIES 3

Doesn't look like a compiler error, or a linker one for that matter.

0xFFFFFFFE would seem to suggest a failure at the stack or interrupt handler level.

Missing/Balnk vectors.

Incorrect call-back addresses/configuration.

Have a proper Hard Fault Handler.

Be aware of your stack utilization.

Example of the direct HAL usage may be found in the CubeF3 repository.

Perhaps have working via Polling methods first, then use Interrupts.

Instrument your code to understand what's happening before the debugger traps with an error.

Debug the problem.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I try to debug the problem and I found that error appear during the clock configuration(SystemClock_Config) more specifically after  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK).

I can't explain the source of the error, because my chosen configuration is the following:

 PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART3;

 PeriphClkInit.Usart3ClockSelection = RCC_USART3CLKSOURCE_HSI;

I chose the HSI to be sure that it will not be influenced.

I also checked, all configurations are made to work with the polling method.

TGill.4
Associate II

I tried several things and I realized that the uart configurations should be added to a separate .c file instead of trying to copy them to the main or elsewhere. This way it's easier and it works without problems.