Using EMW3165 with eclipse

In last article I tested EMW3165 with available tools starting with simple examples of WICED SDK.

Now I want to share first experiences with a more “comfortable” developing tool like eclipse.

Starting from the fact that EMW3165 is based on STM32F411 i tried to setup and use a toolchain based on standard processor.

I found this excellent article on setting up toolchain for a stm Nucleo.

I followed step by step the tutorial and tested the result on a standard stm nucleo. All worked well!

Now is the turn of EMW3165: to obtain correct result is necessary to adjust clock settings with specific values.

Starting from indicated tutorial you should create a similar blink led example:

  1. Click File > New > C Project and select “STM32F4xx C/C++ Project”
  2. Select configuration as showed
  3. Click next on following 2 steps
  4. Select correct toolchain (you should have installed following referred tutorial)
  5. Click finish and you should be with project created.
  6. Open _initialize_hardware.c and find SystemClock_Config function
  7. Replace existing code with this code (obtained from CubeMx tool)
      RCC_OscInitTypeDef RCC_OscInitStruct;
      RCC_ClkInitTypeDef RCC_ClkInitStruct;

      __PWR_CLK_ENABLE();

      __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

      RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
      RCC_OscInitStruct.HSIState = RCC_HSI_ON;
      RCC_OscInitStruct.HSICalibrationValue = 16;
      RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
      RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
      RCC_OscInitStruct.PLL.PLLM = 26;
      RCC_OscInitStruct.PLL.PLLN = 200;
      RCC_OscInitStruct.PLL.PLLP = 2;
      RCC_OscInitStruct.PLL.PLLQ = 4;
      HAL_RCC_OscConfig(&RCC_OscInitStruct);

      RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1;
      RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
      RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
      RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
      RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
      HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);

      HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

      HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

      // SysTick_IRQn interrupt configuration
      HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);

NOTE:

These values are not completely verified, I extracted from platform_config.h of wiced-emw work of EmilFR.

After that I chose an output pin for led : in my case  I connected led with pin PA5 and changed defnition in BlinkLed.h:

// STM32F4DISCOVERY definitions (the GREEN led, D12, active high)
// (SEGGER J-Link device name: STM32F407VG).

#define BLINK_PORT_NUMBER               (0)
#define BLINK_PIN_NUMBER                (5)
#define BLINK_ACTIVE_LOW                (0)

#endif

Last step build program and upload into emw3165 with ST-LINK.

OK led is blinking !

….but frequency of blinking is not what expected, so further investigations are needed.

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...