[Tinyos-help] BaseStationCC2420 does not act as a sniffer: patch

Philip Levis pal at cs.stanford.edu
Tue Jan 30 08:29:03 PST 2007


On Jan 30, 2007, at 6:40 AM, Alban Hessler wrote:

> Hi everyone,
>
> We have found a small bug in the file CC2240ControlP.nc for the  
> BaseStationCC2420 application of T2.
>
> In order to be a sniffer (that's what BaseStation is according to  
> the readme), the BaseStation should disable the address filtering  
> of the CC2420. For that to be done, it must explicitly set the bit  
> to 0 in the registry, as the default reset value is 1. (datasheet  
> of CC2420, p.65)
>
> So the code to set the configuration register in CC2240ControlP.nc  
> should be the following:
>
> call MDMCTRL0.write( (( 1 << CC2420_MDMCTRL0_RESERVED_FRAME_MODE ) |
>       ( 2 << CC2420_MDMCTRL0_CCA_HYST ) |
>       ( 3 << CC2420_MDMCTRL0_CCA_MOD ) |
>       ( 1 << CC2420_MDMCTRL0_AUTOCRC ) |
>       ( 2 << CC2420_MDMCTRL0_PREAMBLE_LENGTH )) &
>       ~( 1 << CC2420_MDMCTRL0_ADR_DECODE));
>
>
> Notice the added mask at the end of the instruction.
>
> Best Regards,
>
> Alban Hessler & Evgeny Osipov
>

This isn't necessary. It's not a read-modify-write of the register,  
just a plain write.

Phil



More information about the Tinyos-help mailing list