cancel
Showing results for 
Search instead for 
Did you mean: 

IDW01M1 Wifi Sample Codes for STM32F411RE

Robert Kwan
Associate II
Posted on April 26, 2017 at 07:24

Hello!

I recently bought the IDW01M1 WiFi expansion board 

and I am trying to have it working with the STM32F411RE.

However, from the examples in en.x-cube-wifi1_firmware.zip,

I can find the .bin file for STM32F401RE-Nucleo only

and so I tried to flash this WiFi_VCOM .bin to the STM32F411RE board.

I can see LED1 is green, so power is ok.

No other LED On, so module is ok?!

When I use Tera Term, I don't see any output and when I send 'AT', no 'OK' either.

So my question is that  F401RE .bin image cannot work directly on F411RE board please?!

Since I am still a newbie to this WiFi module, I am not sure if it will be easy to recompile the sample application for F411RE then?!

Any suggestion / comment is welcome.

Thanks & Best Regards,

Robert

#stm32f411re-wifi-idw01m1
41 REPLIES 41
Robert Kwan
Associate II
Posted on June 01, 2017 at 13:26

Hi Mridu,

I tried different combinations of mbed files and the original Server_Socket files

but without much success.

1. In my previous builds, I didn't use the syscalls.c from Server_Socket sample but retarget.c from mbed.

    However, if I tried to use ./Projects/Multi/Applications/Server_Socket/SW4STM32/STM32F411RE-Nucleo/syscalls.o

    I would not be able to compile at all, so I have to stay with

    $(MBED_PATH)/$(TARGET_BOARD)/TOOLCHAIN_GCC_ARM/retarget.o 

  

So in my Makefile, I use all the other files from the Server_Socket sample except the syscalls.c:-

./Drivers/BSP/STM32F4xx-Nucleo/stm32f4xx_nucleo.o \

./Drivers/BSP/X-NUCLEO-IDW0xx1/stm32_spwf_wifi.o \

./Middlewares/ST/STM32_SPWF0xSy/Utils/event_buffer.o \

./Middlewares/ST/STM32_SPWF0xSy/Utils/ring_buffer.o \

./Middlewares/ST/STM32_SPWF0xSy/Utils/spwf04WiFi.o \

./Middlewares/ST/STM32_SPWF0xSy/Utils/wifi_globals.o \

./Middlewares/ST/STM32_SPWF0xSy/wifi_interface.o \

./Middlewares/ST/STM32_SPWF0xSy/wifi_module.o \

./Middlewares/ST/STM32_SPWF0xSy/wifi_module_spi.o \

./Middlewares/ST/STM32_SPWF0xSy/wifi_module_uart_01.o \

./Middlewares/ST/STM32_SPWF0xSy/wifi_module_uart_04.o \

./Projects/Multi/Applications/Server_Socket/Src/stm32_xx_hal_msp.o \

./Projects/Multi/Applications/Server_Socket/Src/stm32_xx_it.o \

./Projects/Multi/Applications/Server_Socket/Src/console.o \

./Projects/Multi/Applications/Server_Socket/Src/system_stm32f4xx.o \

./Projects/Multi/Applications/Server_Socket/SW4STM32/STM32F411RE-Nucleo/startup_stm32f411xe.o

##./Projects/Multi/Applications/Server_Socket/SW4STM32/STM32F411RE-Nucleo/syscalls.o

2. My latest build would not trigger the Wifi_TIM_Handler() as I reported yesterday after all the different trials.

    Since I didn't really modify any C codes, the only things I played around were the Makefile and the LinkerScript.ld.

    So I suspect that I made some wrong change in the LinkerScript.ld?!

    In fact, I use the one from mbed as the base:-

    LINKER_SCRIPT = $(MBED_PATH)/$(TARGET_BOARD)/TOOLCHAIN_GCC_ARM/$(TARGET_LD).ld

    and so some potential conflict with the files from Server_Socket sample?!

Therefore, I am clueless now...

Thanks & Best Regards,

Robert

Robert Kwan
Associate II
Posted on June 03, 2017 at 13:45

Hello!

I would like to ask if the SysTick_Handler in the isr_vector never gets triggered in my program,

how can I see if the interrupt flag is enabled correctly or not under Eclipse IDE / OpenOCD debug environment please?

Thanks & Best Regards,

Robert

Posted on June 06, 2017 at 20:35

Hi,

you can check STM32 or Cortex-M4 reference manual to find the flag address. Probably it's a 0xE000something...

BR

j

Robert Kwan
Associate II
Posted on June 06, 2017 at 23:38

Thanks Jerry!

I found from the Cortex-M4 reference manual that

0xE000E010 STCSR SysTick Control and Status Register

0xE000E014 STRVR SysTick Reload Value Register

For the pure Socket Server sample app,

these two registers would have the values:-

0xE000E010 STCSR SysTick Control and Status Register  0x07000100

0xE000E014 STRVR SysTick Reload Value Register          0x1F480100

after wifi_init()

However, for my mixed mbed build,

I will have 0x0 only.

However, when I forced these two registers to have the same values,

0xE000E010 STCSR SysTick Control and Status Register  would take only 0x07000000

and the initialization will then be completed ok with the printf().

And SysTick Control and Status Register  would become 0x07000100 eventually as well.

Therefore, it seems that somehow my mixed mbed HAL drivers or the linkerScript.ld will make the SysTick initialization failed?!

However, I have no idea on how to debug this further.

Any suggestion please?

Thanks & Best Regards,

Robert

Robert Kwan
Associate II
Posted on June 07, 2017 at 02:05

Hello!

I observed another weird behavior when I tried to find out when the SYSTICK CTRL register would be set.

In the original Server Socket sample app,

I can step into the HAL_InitTick() and then I will go to the HAL_SYSTICK_Config() inside the core_cm4.h.

However, in my mixed build,

it would not get into any HAL_SYSTICK_Config() when I tried to step into the HAL_InitTick()

and similar problem to the following HAL_MspInit() too.

But when I checked the .map file, I can see:

.text.HAL_SYSTICK_Config

                0x00000000       0x38 c:/BG1/IoT/SensorTool_012017/RadioSensorlib/Matlab/Nucleo/mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cortex.o

while in the .map file of the original sample app:-

.text.HAL_SYSTICK_Config

                0x080004f4       0x2c Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_cortex.o

                0x080004f4                HAL_SYSTICK_Config

So it seems that the mbed's stem32f4xx_hal_cortex.o is different from the sample app's...?!

Thanks & BR,

Robert

Robert Kwan
Associate II
Posted on June 07, 2017 at 02:17

So I tried to use the stm32f4xx_hal_cortex.c from the sample app instead,

but the compiled image would still have the HAL_SYSTICK_Config() be in the Discarded Input Sections.

And I have no idea on why it would be placed in the Discarded Input Sections please?!

Thanks & Best Regards,

Robert

Robert Kwan
Associate II
Posted on June 09, 2017 at 00:43

Hello!

I would like to ask if the parameter unit for HAL_Delay() in the STM HAL driver is ms or us please.

After twisting my merged codes a bit more without using the mbed hal_tick.o,

I can have the WiFi module initialized ok now

but then my original code would not work anymore

because we use wait_ms() and wait_us() from the mbed driver,

which I cannot use anymore now...

I think that HAL_Delay() is taking the parameter as ms only?!

And if so, how can I implement something like for waiting for x us delay please?

Thanks & BR,

Robert

Posted on June 10, 2017 at 12:26

From

HAL_Delay() into 

hal.c file:

/**

* @brief This function provides accurate delay (in milliseconds) based

* on variable incremented.

* @note In the default implementation , SysTick timer is the source of time base.

* It is used to generate interrupts at regular time intervals where uwTick

* is incremented.

* @note This function is declared as __weak to be overwritten in case of other

* implementations in user file.

* @param Delay: specifies the delay time length, in milliseconds.

* @retval None

*/
Robert Kwan
Associate II
Posted on June 10, 2017 at 23:49

Hi Jerry,

Thanks for the confirmation.

I saw that too.

So my next question is any way to have us delay as in mbed implementation please?

If not, I still cannot use this module then.

It's pretty bad that after all the efforts to get it so close but still cannot use it.

Thanks & Best Regards,

Robert

Posted on June 11, 2017 at 12:00

I'm not familiar with that code. However, module is not requiring us delay. You can replace us with 1ms...

If cannot, this is a simple code waiting for us:

void udelay(u16 us)

{

volatile u32 loops = (SystemCoreClock / 1000000) * us;

while(loops--);

}