
Hi Andreas,
On Thu, Aug 16, 2012 at 05:33:26PM +0200, Andreas Bießmann wrote:
On 16.08.2012 17:07, Markus Hubig wrote:
<snip>
But it definitly dosn't work here. I checked with an oscilator, if I toggle the pin in board_init() I can nicely see it going high and low but if I toggle it in board_early_init_f() *nothing* happens!
Well as mentioned in my mail the mdelay() can not work in board_eraly_init_f() cause the timers are not setup at this stage. You need to provide some nop-loop based delay here to have proper delay! As mentioned before my at91sam9263 (running at about 200 MHz produce 38 us out of a mdelay(10); I dunno what your g20 variant with about 400 MHz produces here). A simple test could be to move the timer init in a/a/lib/board.c before board_early_init_f in the init_sequence. Then the mdelay() will work as expected!
You were right! The problem was the missing delay after setting the pin! Just moving the timer_init() before board_early_init_f() in the init_sequence didn't work because we need the clocks from board_early_init_f() first. But I found the
| board_postclk_init()
function and the corresponding
| CONFIG_BOARD_POSTCLK_INIT
switch, so I put everything there and now it all works fine! ;-)
send a patch (including working serial console output ;)
Unfortunately the board_postclk_init() function was not in the init_sequence at arch/arm/lib/board.c so I added it there. I will provide two patches, one for the board stuff and one for the stamp stuff, if this is OK with you ...
Cheers, Markus