Page 1 of 1

STM32F407xE failure

Posted: Thu Mar 21, 2013 2:17 pm
by Tectu
Hello folks,

I just soldered my very first STM32 myself. It's an STM32F407ZET6 in an LQFT 144 package. I can successfully connect to it using OpenOCD over JTAG. I am also able to reset the MCU and load the image into it. Now I wanted to make sure that it works by simply toggling an LED. However, as soon as I run it, it gets stuck here:

Code: Select all

port_halt () at /home/tectu/projects/resources/chibios/os/ports/GCC/ARMCMx/chcore.c:43
43     }
(gdb) l
38   #endif
39   void port_halt(void) {
40   
41     port_disable();
42     while (TRUE) {
43     }
44   }
45   
46   /** @} */
(gdb)


When I comment halInit(); the execution procedes and I can actually stop on breakpoints etc. I'm not exactly sure what causes this issue? I simply took the linker script file for the STM32F407xG and simply decreased the flash size from 1M to 512k. What else am I missing? This seems to be a HAL problems but the HAL of both the MCUs are the same?


~ Tectu

Re: STM32F407xE failure

Posted: Thu Mar 21, 2013 3:52 pm
by Giovanni
It should work by just changing the flash size.

Apparently it crashes at some point, if you are able to go single step inside halInit() you could understand exactly where, this would give us an hint.

Giovanni

Re: STM32F407xE failure

Posted: Thu Mar 21, 2013 3:56 pm
by Tectu
I found the error. Through this backtrace:

Code: Select all

And here's a backtrace:
[code]
(gdb) bt
#0  port_halt ()
    at /home/tectu/projects/resources/chibios/os/ports/GCC/ARMCMx/chcore.c:43
#1  0x08003650 in mii_find_phy (macp=0x20000a70)
    at /home/tectu/projects/resources/chibios/os/hal/platforms/STM32/mac_lld.c:142
#2  0x08003890 in mac_lld_init ()
    at /home/tectu/projects/resources/chibios/os/hal/platforms/STM32/mac_lld.c:259
#3  0x080016e6 in macInit ()
    at /home/tectu/projects/resources/chibios/os/hal/src/mac.c:67
#4  0x0800162a in halInit ()
    at /home/tectu/projects/resources/chibios/os/hal/src/hal.c:90
#5  0x080054a6 in main () at main.c:5


I found out, that there's a problem with the MAC driver. I disabled the MAC subsystem in the halconf.h and now everything works as well. As jpa- menioned in the irc, the MAC subsystems halts when there's no PHY connected.


~ Tectu

Re: STM32F407xE failure

Posted: Thu Mar 21, 2013 3:58 pm
by Giovanni
It is the normal behavior, you are not supposed to enable the MAC driver if there is no HW to support it. I am glad it works anyway have fun :)

Giovanni

Re: STM32F407xE failure

Posted: Thu Mar 21, 2013 4:28 pm
by Tectu
Giovanni wrote:you are not supposed to enable the MAC driver if there is no HW to support it.

That's exactly what jpa said ^^
I just copied the project which worked on my Olimex E407 board but indeed I don't have any PHY on my own ;)
Thanks for the help!


~ Tectu