Open-ZB stack porting to TmoteSky
Weekly reports
Weekly Reports - what is done, what is doing, what will be done.
Project definition
Open-ZB protocol stack designed at Polytechnical institute of Porto, Portugal is implemented for MicaZ platform in TinyOS/nesC and we would like to port it to TmoteSky (TelosB) platform.
OpenZB-stack is developed for the MicaZ platform. My first task is to transform OpenZB-stack to the TelosB platform (Tmote Sky). Second task is develop aplication by using TinyOS for data collection along through the wireless body area network for monitoring physical condition of a Parkinson’s disease patient.
Developing phase
[15,16 - 2007]
Website "Main modifications of Open-ZB stack" was moved:
--- New location of pages "Main modifications of Open-ZB stack" ---
[13,14 - 2007]
update website:
[11,12 - 2007]
- created website:
- Main modifications of Open-ZB stack
[9,10 - 2007]
I did small changes, see down..
- add the first error:
- I dont't rename PIN but add PIN
- \tinyos-1.x\contrib\hurray\tos\platform\telos|telosb\hardware.h
- new code:
TOSH_ASSIGN_PIN(RADIO_CCA, 1, 4); TOSH_ASSIGN_PIN(CC_CCA, 1, 4);
- add the second error:
- implementation of functions for Telos:
module HPLCC2420M { provides { ... } uses { ... interface MSP430Interrupt as FIFOPInterrupt; } } implementation { ... async command result_t HPLCC2420.enableFIFOP(){ atomic { call FIFOPInterrupt.disable(); call FIFOPInterrupt.clear(); call FIFOPInterrupt.edge(0); <- CHANGE call FIFOPInterrupt.enable(); } return SUCCESS; } async command result_t HPLCC2420.disableFIFOP(){ atomic { call FIFOPInterrupt.disable(); call FIFOPInterrupt.clear(); } return SUCCESS; } async event void FIFOPInterrupt.fired(){ call FIFOPInterrupt.clear(); call FIFOPInterrupt.disable(); call FIFOPInterrupt.clear(); } }
async command result_t HPLCC2420.disableFIFOP() { atomic { call FIFOPInterrupt.disable(); call FIFOPInterrupt.clear(); } return SUCCESS; }
async event void FIFOPInterrupt.fired(){ // signal the interrupt signal HPLCC2420.FIFOPIntr(); <- CHANGE
}
- add the third error:
- I try replace the function "Timer2.setIntervalAndScale" in HPLTimer2 (TimerAsync.start), which sets timer and starts and enables interrupt, directly calling to make the Timer with tick granularity equals 69 microseconds (requirement is 69.54 us), by interface with argument (tinyos-programming, pages 29-32).
- ..and link to it the nacessary steps and TinyOS would set, start and enables interrupt. In "TimerAsync.stop" would be call the Timer destructor instead disable interupt.
- But I don't thing that it would be so simple. Since no other idea how we going to deal with this problem on a low-level.
[7,8 - 2007]
- Rectifying errors:
- Blink application (\tinyos-1.x\contrib\hurray\apps\Blink\)
modification of file \tinyos-1.x\contrib\hurray\tos\platform\msp430\PowerManagementM.nc changes were inspired by the PowerManagementM file of MicaZ platform. The new code:
module HPLPowerManagementM { provides { interface PowerManagement; command result_t Enable(); command result_t Disable(); } } implementation { async command uint8_t PowerManagement.adjustPower() { return SUCCESS; } command result_t Enable() { LPMode_enable(); return SUCCESS; } command result_t Disable() { LPMode_disable(); return SUCCESS; } }
modification of Makefile to accept the another two platforms - telos and telosb (the problem from [5,6 - 2007] solved)
- some Makefiles: Blink_makefiles
- a sample of compilation: Blink_make
- AssociationExample application (\tinyos-1.x\contrib\hurray\apps\AssociationExample\)
modification of Makefile to accept the another two platforms - telos and telosb Makefile is similar to the file for Blink application a sample of compilation: AssociationExample_make
- first error:
location of header files:
- - avr-system
- \usr\local\avr\include\
- - avr-hardware
- \tinyos-1.x\contrib\hurray\tos\platform\avrmote\avrhardware.h
- - mica-hardware
- \tinyos-1.x\contrib\hurray\tos\platform\mica|mica2|micaz\hardware.h
- - msp430-system
- \usr\local\mspgcc\msp430\include\
- - msp430-hardware
- \tinyos-1.x\contrib\hurray\tos\platform\msp430\msp430hardware.h
- - telos-hardware
- \tinyos-1.x\contrib\hurray\tos\platform\telos|telosb\hardware.h
I want MAC and PHY files to remain unchanged. I found the matching PIN on hardware files.
- Excerpts:
\tinyos-1.x\contrib\hurray\tos\platform\avrmote\avrhardware.h
#define TOSH_ASSIGN_PIN(name, port, bit) \ static inline int TOSH_READ_##name##_PIN() \ {return (inp(PIN##port) & (1 << bit)) != 0;} #define TOSH_ALIAS_PIN(alias, connector) \ static inline char TOSH_READ_##alias##_PIN() \ {return TOSH_READ_##connector##_PIN();}
\tinyos-1.x\contrib\hurray\tos\platform\micaz\hardware.h
TOSH_ASSIGN_PIN(CC_CCA, D, 6);
\tinyos-1.x\contrib\hurray\tos\platform\msp430\msp430hardware.h
#define TOSH_ASSIGN_PIN_HEX(name, port, hex) \ uint8_t TOSH_READ_##name##_PIN() \ { MSP430REG_NORACE2(r,P##port##IN); return (r & hex); }
\tinyos-1.x\contrib\hurray\tos\platform\telos|telosb\hardware.h
TOSH_ASSIGN_PIN(RADIO_CCA, 1, 4);
modification - rename PIN: <- CHANGE, don't rename but addition
RADIO_CCA -> CC_CCA: TOSH_ASSIGN_PIN(CC_CCA, 1, 4);
- second error:
- Simple insertion the missing functions from HPLCC2420M (MicaZ platform) to HPLCC2420M (telos platform, telosb haven't its own modul, use this one) is impossible.
- Changes were inspired by the implementation for MicaZ platform. Comparing files (HPLCC2420C, HPLCC2420M, HPLCC2420InterruptM) for MicaZ platform in TinyOS with files (HPLCC2420C, HPLCC2420M, file HPLCC2420InterruptM isn't here - requisite functions are implemented into HPLCC2420M) in stack.
- I discovered a diferrences and apply changes for Telos platform the same way. I'm testing it now. I will try out the assumed code. It won't work errorless probably. <- Since OK.
- Excerpts, implementation of functions for Telos <- CHANGE
module HPLCC2420M { provides { ... } uses { ... interface MSP430Interrupt as FIFOPInterrupt; } } implementation { ... async command result_t HPLCC2420.enableFIFOP(){ atomic { call FIFOPInterrupt.disable(); call FIFOPInterrupt.clear(); call FIFOPInterrupt.enable(); } return SUCCESS; } async command result_t HPLCC2420.disableFIFOP(){ atomic { call FIFOPInterrupt.disable(); call FIFOPInterrupt.clear(); } return SUCCESS; } async event void FIFOPInterrupt.fired(){ call FIFOPInterrupt.clear(); call FIFOPInterrupt.disable(); call FIFOPInterrupt.clear(); } }
- in detail: AssociationExample_HPLCC2420
- third error:
- "In component TimerAsyncC component HPLTimer2C not found"
- Will probably be need some larger modification of code. I must study documentation properly - Reference Guide, Cunha, Alves, pgs.42-51
- Small changes on files:
- \tinyos-1.x\contrib\hurray\tos\platform\telos\.platform
- \tinyos-1.x\contrib\hurray\tos\platform\telosb\.platform
- deletion of unnecessary specification "push"
- \tinyos-1.x\contrib\hurray\apps\platform.properties
- \tinyos-1.x\contrib\hurray\platform.properties
- addition of telosb platform data
[5,6 - 2007]
I used the TinyOS Tmote Sky hardware modules:
- \tinyos-1.x\tos\platform\msp430\
- \tinyos-1.x\tos\platform\telos\
- \tinyos-1.x\tos\platform\telosb\
copied it to:
- \tinyos-1.x\contrib\hurray\tos\platform\
(during the testing and improvements, it's not necessary to copy all files, but only a modified files) and I'm trying to modify some files.
Since wasn't necessary change the PHY-layer files, because I have basic problem:
During compiling the Blink application to a telosb binary:
- In file included from \tinyos-1.x\contrib\hurray\tos\system\Main.nc from Blink.nc
- In component 'PotC':
- \tinyos-1.x\contrib\hurray\tos\system\PotC.nc component HPLPotC not found
- In file included from Blink.nc:
- In component 'Main':
- \tinyos-1.x\contrib\hurray\tos\system\Main.nc component HPLInit not found
- In file included from \tinyos-1.x\contrib\hurray\tos\system\TimerC.nc from SingleTimer.nc and Blink.nc
- In component 'ClockC':
- \tinyos-1.x\contrib\hurray\tos\system\ClockC.nc component HPLClock not found
That's right. I thing, I have to change the directory \tinyos-1.x\contrib\hurray\tos\system\ to \tinyos-1.x\contrib\hurray\tos\platform\msp430 before linking someway, so that all files included in \tos\system (as well as in \platform\msp430) were replace by the files from \platform\msp430. The files in \tos\system\ are primarily determined for other platforms (e.g. Mica). You can see:
The Blink application uses these files: MicaZ platform:
- platform/micaz/PowerManagementM.nc
- system/ClockC.nc, LedsC.nc, Main.nc, NoLeds.nc, PotC.nc, PotM.nc, RealMain.nc, TimerC.nc, TimerM.nc
- tos/platform/avrmote/HPLInit.nc
- tos/platform/mica/HPLClock.nc
- tos/platform/mica2/HPLPotC.nc
TelosB platform:
- tos/platform/msp430/HPLInitC.nc, HPLInitM.nc, LocalTime.nc, MSP430Capture.nc, MSP430ClockC.nc, MSP430ClockInit.nc, MSP430ClockM.nc, MSP430Compare.nc, MSP430DCOCalibC.nc, MSP430DCOCalibM.nc, MSP430Timer.nc, MSP430TimerC.nc, MSP430TimerControl.nc, MSP430TimerM.nc, Main.nc, MainM.nc, TimerC.nc, TimerJiffy.nc, TimerM.nc, TimerMilli.nc
- tos/system/LedsC.nc
I think, it's a problem in a 'Makefile' file. I tried to add to the 'Makefile' (\tinyos-1.x\contrib\hurray\apps\Blink\)
- PFLAGS += -I$(HURRAYROOT)/platform/msp430
but the compiler takes the files still from \tinyos-1.x\contrib\hurray\tos\system\
- -> this problem solved
[3,4 - 2007]
- zjistil jsem, ktere soubory pouziva implementace fyzicke vrstvy, je tvorena soubory:
- \contrib\hurray\tos\lib\phy\ phy_const.h, phy_enumerations.h, Phy.nc, PhyM.nc
- je treba najit odpovidajici soubory patrici msp430 a telosu, ktere spravuji prikazy a udalosti, ktere obsahuji posledni dva hlavni soubory a upravit je - implementovat v nich dalsi obsazene prikazy a udalosti
- pouziva:
- \contrib\hurray\tos\lib\CC2420Radio\ byteorder.h, HPLCC2420.nc, HPLCC2420FIFO.nc, HPLCC2420RAM.nc
- z CC2420Control.nc a CC2420ControlM.nc jsou pouzity parametry a data pro PhyM.nc
- mely by zustat stejne
- \contrib\hurray\tos\platform\avrmote\ HPLInit.nc, HPLPotC.nc
- najit odpovidajici soubory pro msp430
- \contrib\hurray\tos\platform\micaz\ HPLCC2420C.nc, HPLCC2420FIFOM.nc, HPLCC2420M.nc, HPLPowerManagementM.nc,
- HPLTimer2.nc, HPLTimer2C.nc
- najit odpovidajici soubory pro telos a telosb
- \contrib\hurray\tos\system\ frame_format.h, Main.nc, RealMain.nc, PotC.nc, PotM.nc
- mely by zustat stejne
- \contrib\hurray\tos\interfaces\ Pot.nc, HPLPot.nc, PowerManagement.nc, StdControl.nc,
- mely by zustat stejne
- \contrib\hurray\tos\interfaces\ieee802154\phy\ all
- mely by zustat stejne
- protoze nelze pouze jednoduse zamenit soubory a jejich provazani je do velke hloubky, zacal jsem prodrobne analyzovat vsechny soubory vyse, abych mel alespon "predstavu" jak vse spolu komunikuje, jak je vse provazano, co co vola a pouziva, na co se co odkazuje, protoze abych porozumel, jak presne vrstva funguje a co se v ni pri behu deje, na to (snad postupem casu) nemam znalosti.
- pro nalezeni veskerych provazani jsem chtel pouzit vytvorenou dokumentaci (pomoci graphviz), moje jedine informace jsou z Technical Report (Andre Cunha, Mario Alves), coz je malo, bohuzel s temito problemy:
- - prelozit soubory MAC vrstvy nelze, vytvorit dokumentaci lze
- - prelozit soubory PHY vrstvy ani vytvorit dokumentaci nelze
- Nevite proc? Jestli se soubory kompiluji vsechny spolecne s aplikaci nebo nejak jinak, protoze pri prekladu aplikace pro micaz probehne vse ok (ale neoverim jestli to funguje, mam k dispozici pouze modul telosb).