2017-10-09 09:23 AM
Hello everyone!
I'm new in the stm32 world and I have to say, I realy like it!
I am under Ubuntu and I use '
Eclipse System Workbench
' pre-configured IDE. I only use standart-stm32 library for now.I had some practise on a stm32f0-discovery board (no problem here), but now I have to work on a
stm32f107vc UC on a custom board
. When I created my new project(on eclipse system workbench), I also created a new board with the appropriate UC.USART TX sending bad characters:
When I send 'Hello\r\n' through USART, I read 'ZE]F�' on the TX. But if I make a new project, selecting a NUCLEO stm32F103 board, and I use exactly the same code to program my stm32f107 board, it works....So my question would be:
How to configure my project in the case of a Custom board (considering I am working with eclipse IDE, or not)?
I would be very thankfull if anyone could give me any idea, or track to follow... and I hope my question is clear enough.
Alex
#stm32 #eclipse #custom-board #configuration2017-10-09 10:26 AM
Misconfigured system clock?
JW
2017-10-10 07:19 AM
Thanks for the answer. Well I don't think it is, as I said, the exact same code will work on an other board description.
I found an other workaround, I changed a preprocessor option of my compiler from 'STM32F10X_CL' to 'STM32F10X_MD' and now I receive the good characters from the stm32.
The strange thing is that I am working on a stm32f107 µC, wich is a
Connectivity line device
so it should work with the 'STM32F10X_CL' option.I dont understand whats going on...
If someone has an idea, it would be very appreciated!!
2017-10-10 08:09 AM
the exact same code will work on an other board description.
Only if it would be the same *binary* would it deserve the 'exact same code' label. I doubt this is the case.
So show us how do you set the system clock, or check it through outputting to MCO and measuring it.
In fact it's the APB setting not the system clock as such, so you might also investigate that.
JW
2017-10-10 10:03 AM
Ok I'm sory, I was wrong... Here is how I set the system clock: (here the USART is working, but it looks like )
void SetSysClockTo72(void)
{RCC_DeInit (); // RCC system reset(for debug purpose)
RCC_HSEConfig (RCC_HSE_ON); // Enable HSE// Wait till HSE is ready
while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET);RCC_HCLKConfig (RCC_SYSCLK_Div1); // HCLK = SYSCLK
RCC_PCLK2Config (RCC_HCLK_Div1); // PCLK2 = HCLK (APB2) RCC_PCLK1Config (RCC_HCLK_Div2); // PCLK1 = HCLK/2 (APB1) RCC_ADCCLKConfig (RCC_PCLK2_Div4); // ADCCLK = PCLK2/4*(vu32 *)0x40022000 = 0x01; // Flash 2 wait state
RCC_PLLConfig (RCC_PLLSource_HSI_Div2/*0x00000000*/, RCC_PLLMul_9);
// Enable PLL
RCC_PLLCmd (ENABLE);// Attente synchronisation PLL
while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);// Select PLL as system clock source
RCC_SYSCLKConfig (RCC_SYSCLKSource_PLLCLK);// Wait till PLL is used as system clock source
while (RCC_GetSYSCLKSource() != 0x08);}I think the right option should be 'RCC_PLLSource_PREDIV1/*0x00010000*/' for RCC_PLLConfig, but then the USART wont work...