To complete my previous post, I guess my code is bad, but I don't know
where and why. In fact, I can follow the execution of the code (with
debug leds) until the first call of "I2C.sendCommand();" in
I2CPacket.write() in Atm128I2CMasterPacketP.nc. But after this function,
the program never enters in "I2C.commandComplete()" and that's where I'm
lost. Also, the "hasStart();" function return TRUE, when I include it
before the call of "I2C.sendCommand();".
So, I checked today directly on the hardware with a digital oscilloscope
to watch the frames on the I2C lines, and I saw nothing, which is
confusing me more than before.
If someone could give me a hand on this...
By the way, I saw a program TestMag for tinyos-1.x, so I wanted to test
it ; I installed tinyos-1.1.0 and the CVS update to 1.1.15 but I can't
compile it for IRIS motes (unknown target), and there is no iris folder
in /tinyos-1.x/tos./platforms/
If you have a hint on this too...
Thanks in advance,
Raphael
[EMAIL PROTECTED] a écrit :
> Hi everybody,
>
> I would like to thank the people who helped me out with my problem with Tymo,
> though I don't have the time to try it again for now. In fact, I have a more
> urgent problem right now : I don't understand how to change the amp gain of
> the
> magnetometer.
>
> I know I have to use those 2 functions ( gainAdjustX() and
> gainAdjustY() ) , and 2 events ( gainAdjustXDone() and gainAdjustYDone() ),
> but
> it's not working like it should.
>
> This is my simple test code with adjustment on X-axis only :
>
>
> -------------- CONFIG ------------------
>
>
> #include "XMTS300.h"
> #include "mts300.h"
>
> configuration TestMts300C
> {
> }
> implementation
> {
> components MainC, TestMts300P, LedsC, NoLedsC;
> components new TimerMilliC() as MTS300Timer;
>
> // sensorboard devices
> components new SensorMts300C();
> components new MagXC() as MagX;
>
> TestMts300P -> MainC.Boot;
>
> TestMts300P.MTS300Timer -> MTS300Timer;
> TestMts300P.Leds -> LedsC;
>
> TestMts300P.MagX -> SensorMts300C.MagX;
> TestMts300P.MagY -> SensorMts300C.MagY;
> TestMts300P.Setting -> MagX;
> }
>
>
> ------------ MODULE ---------------
>
>
> #include "Timer.h"
> #include "XMTS300.h"
> #include "mts300.h"
>
> module TestMts300P
> {
> uses
> {
> interface Leds;
> interface Boot;
> interface Timer<TMilli> as MTS300Timer;
>
> interface Read<uint16_t> as MagX; //!< magnetometer sensor
> interface Read<uint16_t> as MagY; //!< magnetometer sensor
>
> interface Mag as Setting;
>
> }
> }
> implementation
> {
> Mts300Msg* pMsg;
>
> event void Boot.booted()
> {
> call MTS300Timer.startPeriodic(1000);
> }
>
> event void MTS300Timer.fired()
> {
> call MagX.read();
> return ;
> }
>
> task void adjustGain()
> {
>
> atomic
> {
> if(call Setting.gainAdjustX(128) == SUCCESS)
> call Leds.led1On();
> else
> call Leds.led2Toggle();
>
> //if(call Setting.gainAdjustY(128) == SUCCESS)
> // call Leds.led2On();
> }
> }
>
> /**
> * MagX data read
> *
> */
> event void MagX.readDone(error_t result, uint16_t data)
> {
> if (result == SUCCESS)
> {
> pMsg->magX = data;
> }
> else
> {
> pMsg->magX = 0;
> }
>
> call MagY.read();
> }
>
> /**
> * MagY data read
> *
> */
> event void MagY.readDone(error_t result, uint16_t data)
> {
> if (result == SUCCESS)
> {
> pMsg->magY = data;
> }
> else
> {
> pMsg->magY = 0;
> }
>
> post adjustGain();
> }
>
> event error_t Setting.gainAdjustXDone(bool result)
> {
> call Leds.led1Off();
> return SUCCESS;
> }
>
> event error_t Setting.gainAdjustYDone(bool result)
> {
> //call Leds.led2Off();
> return SUCCESS;
> }
>
> // end of the implementation
> }
>
>
> When I compile I got those warnings :
>
> /opt/tinyos-2.x/tos/sensorboards/mts300/MagP.nc:83: warning:
> `Mag.gainAdjustXDon
> e' called asynchronously from `I2CPacket.writeDone'
> /opt/tinyos-2.x/tos/sensorboards/mts300/MagP.nc:87: warning:
> `Mag.gainAdjustYDon
> e' called asynchronously from `I2CPacket.writeDone'
>
> When I start the Mote, the led1 turn on, showing that the call of gainAdjustX
> was successful. But the led1 never turn off and the led2 is continously
> toggling. So it seems that only the first call of gainAdjustX() is OK, and
> that
> the event "error_t Setting.gainAdjustXDone(bool result)" is never called.
>
> However, the magnetometer is working properly, cause I can get the values on
> my
> PC (by radio). I have 5 MTS310 boards, and 5 IRIS motes and I tried several
> combinations, the result is the same, so I guess we can exclude a hardware
> problem.
>
> I spent 2 days trying to work it out, in vain, so if you could help me a
> little... it would be great =)
>
> Thank you all,
>
> Raphael
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help