Page 1 of 1

ARMCM4-STM32F407-LWIP demo

Posted: Fri Aug 31, 2012 12:53 pm
by ch_fen
Hello,

I am quite new to the ChibiOS and the STM32 family, so please excuse me if the questions are too basic.
I downloaed the 2.4.2 version of the OS and now am trying to play with the ARMCM4-STM32F407-LWIP demo software. My board is OLIMEX_STM32_P407. My debugger is ST-LINK. I am working in Eclipse with ARM Sourcery GCC for Windows.
I set up the project in Eclipse as described in the manuals and managed to compile it and download on the device.
When I started debugging, the program went in the following endless loop below:

1. file - mac_lld.c
2. line - 310 (function void mac_lld_start(MACDriver *macp))

ETH->DMABMR |= ETH_DMABMR_SR;
while(ETH->DMABMR & ETH_DMAB);

It seems the program can not reset the MAC registers, but I have no idea why.

Have you experienced this problem and can you please give me some hints? My be I have a wrong setting somewhere?

The changes I made from the original project are as follows:

Added "SHELL = C:\Windows\system32\cmd.exe" in the begining of the makefile (otherwise the cs-make crashes with exception)
added in main.c "DBGMCU_Config(DBGMCU_SLEEP | DBGMCU_STANDBY | DBGMCU_STOP, ENABLE);" to allow the debugger to work in low power modes of the MCU.

I guess these changes can not influence the MAC registers reset.

Thanks in advance for the help!

Re: ARMCM4-STM32F407-LWIP demo

Posted: Fri Aug 31, 2012 1:07 pm
by Giovanni
Is the demo able to work unmodified when *not* attached to the debugger? It is possible those changes affect the MAC clock somehow so we need to rule out the possible problem sources.

Giovanni

Re: ARMCM4-STM32F407-LWIP demo

Posted: Fri Aug 31, 2012 2:00 pm
by ch_fen
Hello Giovanni,

I think I figured that one out, but end up on another one.

So regarding the endless loop: I have missed to put in the startup settings of the debugger the command "jump ResetHandler". When this is present and ResetHandler is actually executed I am able to continue the debugging and go to the endless loop in the main.c. From there when I run the application without debugging immediately I get SIGTRAP signal :

Thread [1] (Suspended: Signal 'SIGTRAP' received. Description: Trace/breakpoint trap.)
2 <symbol is not available> 0x55555554
1 <symbol is not available> 0xfffffff8

I also tried to run the application without debugging by programming the MCU with ST-Link Utility and just reset the board, but it is not running again.

ch_fen

Re: ARMCM4-STM32F407-LWIP demo

Posted: Fri Aug 31, 2012 2:04 pm
by Giovanni
I will try to replicate the problem later today once I am back at home.

In the meanwhile could you enable the debug options in chconf.h and see if some assertion is triggered?

Giovanni

Re: ARMCM4-STM32F407-LWIP demo

Posted: Sun Sep 02, 2012 2:54 pm
by Giovanni
Hi,

I've been unable to duplicate this problem on the P407, I tested both 2.4.2 and the unstable from repository. I programmed the device both using the Atollic GDB server and the ST Visual Programmer, no changes.

Giovanni

Re: ARMCM4-STM32F407-LWIP demo

Posted: Mon Sep 03, 2012 1:47 pm
by ch_fen
Hi Giovanni,

It turned out that the jumpers on the board were not set properly (trying to boot from system memory, no wonder now what the debugger have been showing all the time). The Olimex manual for the jumpers is a bit incorrect especially for beginners in STM32 like me. The jumper for changing the boot memory is explained as powering the camera and the one that is explained to be actually doing that is not in the schematic. You can see it on the board named BOOT0-E, but the one that is actually doing the job is B0_1/B0_0.

Anyway your stuff works great now! Thanks for the support!

Cheers,
ch_fen

Re: ARMCM4-STM32F407-LWIP demo

Posted: Thu Aug 08, 2013 10:12 am
by einansus
Hi ch_fen,

where do you inserted the sleep mode debugging activation

Code: Select all

  DBGMCU_Config(
      DBGMCU_CR_DBG_SLEEP | DBGMCU_CR_DBG_STANDBY | DBGMCU_CR_DBG_STOP, ENABLE);
in your project?

I use the following for debugging:
    STM32F415RG
    Atollic TrueSTUDIO gdbserver for ST-Link
    arm-none-eabi-gdb
    chibistudio

How do you debug in sleep mode?

Cheers, einansus

Re: ARMCM4-STM32F407-LWIP demo

Posted: Fri Aug 09, 2013 7:57 am
by einansus
einansus wrote:Hi ch_fen,

where do you inserted the sleep mode debugging activation

Code: Select all

  DBGMCU_Config(
      DBGMCU_CR_DBG_SLEEP | DBGMCU_CR_DBG_STANDBY | DBGMCU_CR_DBG_STOP, ENABLE);
in your project?

I use the following for debugging:
    STM32F415RG
    Atollic TrueSTUDIO gdbserver for ST-Link
    arm-none-eabi-gdb
    chibistudio

How do you debug in sleep mode?

Cheers, einansus


Hello,

I wanted to debug in sleep mode. Where should I insert the following function call:
/*
* Allows debugging in sleep mode:
* http://www.atollic.com/index.php/kb/11- ... ower_modes
*/
DBGMCU_Config(
DBGMCU_CR_DBG_SLEEP | DBGMCU_CR_DBG_STANDBY | DBGMCU_CR_DBG_STOP, ENABLE);


I inserted it into "__early_init__", "ResetHandler", and "main" without success. Maybe someone knows a solution?

Cheers, einansus

Re: ARMCM4-STM32F407-LWIP demo

Posted: Tue Aug 13, 2013 9:36 am
by einansus
I've found a way to debug in sleep mode: Don't initialize the SWD Port, e.g. GPIOA. To skip init for e.g. GPIOA, comment line 124 in "os/hal/platforms/STM32/GPIOv2/pal_lld.c" :

Code: Select all

//  initgpio(GPIOA, &config->PAData);