paparazzi/paparazzi — pull request #351 by dewagter (2013-01-22 15:17:37+00:00)
Title: Master.fix.lpc.xbee

mcu_init calls sys_time_init calling sys_time_arch_init which enables the timer used in sys_time_usleep which uses T0TC = system register, So it should be running as soon as the timer is enabled in sys_time_arch_init.

however, the sys_time_usleep only seems to work after a irqEnable() which is weird.

[in AVR, starting the timer will make the timer run, so reading the timer value T0TC will change all the time, even with no interrupts. ClearInterruptEnable only means that no ISR will be called, not that hard timers will not run.]

Just read the datasheet and there is no reason why T0TC should not run after being enabled, and I can find no reason why enableIRQ (which sets Current Program Status Register IRQ bit) would influence how the timer is running.

Anyone that can explain is welcome.

In the mean time, call xbee_init AFTER mcu_int_enable, just like in fixedwing.