[En-Nut-Discussion] Ethernut on TI's Cortex-M3 (Stellaris LM3S...)

Ole Reinhardt ole.reinhardt at embedded-it.de
Tue Oct 16 10:52:37 CEST 2012


Hi Philipp,

> The initialization procedure of the processor completes and it hits 
> main(). After that, the "run mode clock gating register 2 (RCGC2)" is 
> set to 0x000f, which should enable the clock to GPIO ports A through H. 
> It then does a few dummy reads from the same register, just as noted in 
> the datasheet. The next line would then read Port F's data direction 
> register located at 0x4002.5400. As soon as it tries to read from this 
> memory location, it is thrown into the exception handler with the MMADDR 
> (memory management fault address) pointing to 0x4002.5400.
> So the CPU seems to be quite convinced that it should not access this 
> memory, location, but I have no idea why. Included with StellarisWare is 
> an example called "blinky" which uses more or less the same code 
> (without the ethernut specifics of course) and the LED blinks just fine.
> 
> Oh, what I just checked: The GPIO registers may be accessed through the 
> APB (legacy) or AHB. 0x4002.5400 is in the APB range and the GPIOHBCTL 
> register contains 0, which means that APB is used for all ports. So this 
> should be fine.

I would suppose that the AHB / APB clocks and/or power domains are not
configured correctly.

This would result in a BusFault as soon as you access any peripheral
connected to these busses.

If you look at my LPC port, the core files (which handle the CPU startup
and basic clock configuration) are 

nut/arch/cm3/dev/nxp/lpc177x_8x_clk.c
nut/arch/cm3/dev/nxp/system_lpc177x_8x.c

The system file does not do much relevant things and is just a
placeholder if later any CPU initialisation needs to be added, but the
clock file is very important:

You should at least implement

SetSysClock() and
SysCtlClockGet()

And you should also implement a 

LPxxxxxx_ClockGet()

And connect all these functions with the 

timer.c and 

nut/arch/cm3/os/nutinit.c
nut/arch/cm3/cmsis/ostimer_cortex.c

Have you done this? (I did not check you latest git files...)

> I hoped to be able to solve it myself, but no success so far. Would be 
> great, if you could've a look at it. Compiler input and output can be 
> found here:
> 
> http://hb9etc.ch/ethernut/simple_buggy_20121015.zip

Could you please send me again a link, where I can get your changeset 
and / or a complete Nut/OS tree and a short instruction how to set it up?

I will then set it up here and compile the code this evening and can then 
also test and debug.

bye,

Ole

-- 

Thermotemp GmbH, Embedded-IT

Embedded Hard-/ Software and Open Source Development, 
Integration and Consulting

http://www.embedded-it.de

Geschäftsstelle Siegen - Steinstraße 67 - D-57072 Siegen - 
tel +49 (0)271 5513597, +49 (0)271-73681 - fax +49 (0)271 736 97

Hauptsitz - Hademarscher Weg 7 - 13503 Berlin
Tel +49 (0)30 4315205 - Fax +49 (0)30 43665002
Geschäftsführer: Jörg Friedrichs, Ole Reinhardt
Handelsregister Berlin Charlottenburg HRB 45978 UstID DE 156329280 




More information about the En-Nut-Discussion mailing list