i used the configuration that come with contiki, and i change only the RDC driver, i don't know how to configure the rest, although i tried to change other settings
To work out what settings you need to change you can look at the platform.conf for a platform that does use ContikiMac (such as the Z1) and you can look at ContikiMac.c and ContikiMac.h in the core/net/mac folder. The settings are #define'd with a prefix of "CONTIKIMAC_CONF_". Phase optimisation may not work without some poking so I would suggest leaving it off for now.
As for what to set them to, you should have a read of the ContikiMac paper and look at the ContikiMac sources. You may need to do some measurements and calculations of timings, etc on your radio but this is fairly simple with an oscilloscope or logic analyser and the data sheet for the radio. The paper can be found at: http://dunkels.com/adam/dunkels11contikimac.pdf
i use NETSTACK_RADIO.off() to power off the radio, when i use it the consumption goes from ~30mA to 5mA.
Ok, have you checked to see what mode NETSTACK_RADIO.off() puts the radio in? The ones that I have checked put the radio in an IDLE state, which can use a few mA.
Also, I would recommend using an off command from a higher level of the netstack, especially if you are using some sort of RDC, as higher layers can still turn the radio on and off if you leave them active.
The platform i use hasn't got any sensor or periferial, it only has a SoC with radio and micro together. I looked at its datasheet and i has 4 power modes:
Electronics 101: Datasheets do NOT generally represent reality and may have been massaged to show the lowest energy consumption possible.
You really need to measure your actual platform as the energy values in the Datasheet for your MCU won't cover how it interacts with other parts of your circuit. I would also recommend measuring over more than one node as differences in manufacturing can result in different readings and an accidental short during manufacture could give a higher reading than expected
You say you have no peripherals or sensors - what about power supplies and other passive components? A non-isolateable potential divider (say for doing a batvolts measurement) is a constant current draw that the Datasheet doesn't cover.
I'm newbie with Contiki and i don't know how to do that, if you can explain me it i'll apreciate it. I tried to use the PM modes of the SoC using the register, i want to do it after lanching the processes but i don't know how to.
I am also relatively new to Contiki - I just read the documentation and look at the code.
Putting the SoC into a low power mode in your process probably won't help as the core wakes up from a timer, or other interrupt, to deal with events and set any processes going that need to. This all happens from within a loop in main(), which is in a file in your platform directory, where process_run() is called repeatedly until there are no processes waiting and then puts the core into a low power mode - this is all detailed in the documentation at http://contiki.sourceforge.net/docs/2.6/a01671.html#ga4968157ca91c28e26075ab78a1a4fb56
. So your process putting the core to sleep will either break things for the rest of the OS or, ultimately, have no effect.
What you seem to be missing is that Contiki should already be putting your MCU into a low-power mode when it can. I have had a look at the contiki-main.c file for the CC2530DK platform (you really should have looked at this already - we are not here to spoon feed you) and there is compile-time option for specifying the low power mode. The option is LPM_CONF_MODE and contiki-main.c seems to be able to handle setting this to LPM_MODE_PM2. The contiki-conf.h file for the CC2530DK does not have either of these settings but it does have LPM_CONF_MODE setting and by default sets it to 0 and suggests that only 0 and 1 are supported. You will need to look through the rest of the files for your platform to figure out how to set the LPM mode, I would suggest starting with lpm.h.
My idea is use the register for mantain the micro on PM2 and wake up it every X seconds (with PM2 i can wake up it form the sleep timer interrupt, with PM3 only from external interrupts), then launch a contiki process that sets the radio and uses the contiki functionality with IPV6 to send and receive messages during a sort time, once the process is over, it has to go back to low power mode. I don't know if it's possible.
I hope you now realise that this is a very bad idea and defeats the purpose of actually having Contiki and that you seem to be trying to do achieve something (keeping the core in a low-power state for as long as possible) that Contiki already does/can do. You really do need to read the relevant parts of the documentation, read the wiki and look at the code - that is all I have done to write this reply.
Additionally, if you are using RPL or some other dynamic routing, or a multi-hop setup, having the radio off for several seconds will, as I have said before, cause issues and will likely result in more network traffic that will increase your energy usage. Anything wanting to talk to the node will also have to be aware of when the radio will be on and wait till then to try and talk to it - not the easiest thing to synchronise with a small communications window.
Sent from my iPad