RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

CC2420 initialization code not run?

Open rousselk opened this issue 12 years ago • 7 comments

This is kind of strange, but I get the impression the CC2420 initialization functions (like cc2420_spi_init() and the likes) are not called during the initialization process. It may explain some strange behaviour encountered while using CC2420 on various boards. I think about #315, and erroneous behaviour I get on TelosB port...

Could someone explain me how these functions are supposed to be called in RIOT's initialization process?

rousselk avatar Mar 17 '14 12:03 rousselk

After tracing, I confirm that the CC2420 initialization code is not executed by default: this prevent the transceiver oscillator to be started. Of course, no packet can be sent or received in these conditions...

rousselk avatar Mar 17 '14 14:03 rousselk

What about https://github.com/RIOT-OS/RIOT/blob/master/drivers/cc2420/cc2420.c#L25?

OlegHahm avatar Mar 17 '14 17:03 OlegHahm

That's the problem: it seems this function cc2420_init() is not executed.

I thought that including the CC2420 module from my board definition would somehow automatically call the initialization code for this radio transceiver, but it doesn't seem to be the case... Did you notice this problem too?

rousselk avatar Mar 18 '14 12:03 rousselk

Usually the radio init function should be called by the transceiver module: https://github.com/RIOT-OS/RIOT/blob/master/sys/transceiver/transceiver.c#L209 If you don't want to use the transceiver interface, you need either to call cc2420_init() in your application or use auto_init() (and add cc2420_init() to this module).

OlegHahm avatar Mar 18 '14 12:03 OlegHahm

OK, so it's currently up to the application to "include" the radio transceiver module to have the CC2420 work.

I somehow feel this is quite strange, since the radio module is built-in (i.e. soldered to) motes like the TelosB and the Z1... Shouldn't we call transceiver module initialization functions in board_init() for these motes?

rousselk avatar Mar 19 '14 09:03 rousselk

What about application that don't need the radio? The current RIOT philosophy is that all features are disabled by default and need explicitly enabled (by adding the according USEMODULE to the Makefile and calling its init function (or use auto_init)). This way give the application developer the full flexibility to tailor the application as needed and exclude side effects from unused modules and be more efficient (in terms of memory and CPU usage).

I think auto_init is exactly the right feature for what you're talking about: the application designer specifies which modules the application needs and RIOT initializes them automatically (if possible).

OlegHahm avatar Mar 19 '14 10:03 OlegHahm

OK, I see the point. Case solved.

rousselk avatar Apr 02 '14 07:04 rousselk