cancel
Showing results for 
Search instead for 
Did you mean: 

Eclipse/workspace configuration for custom boards

Greusard Alexandre_2
Associate II
Posted on October 09, 2017 at 18:23

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.
  • My first problem (and workaround): Interruptions made my code stop , workaround -> I modified the file 'startup_stm32.s' and added Interruptions to my vector table 'g_pfnVectors', it works for now.
  • My second problem:

    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 #configuration
4 REPLIES 4
Posted on October 09, 2017 at 19:26

Misconfigured system clock?

JW

Posted on October 10, 2017 at 14:19

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!!

Posted on October 10, 2017 at 15:09

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

Posted on October 10, 2017 at 17:03

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...