| Author |
Message |
|
|
Posted: Mar 18, 2011 - 08:31 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
|
troyka wrote:
now, on router side, if I do
You mean coordinator?
In this code SENDING state refers to sending of local coordinator's data, it has nothing to do with received over the air data. Application deals with received data in the APS_DataIndCoord() function. |
|
|
| |
|
|
|
|
|
Posted: Mar 18, 2011 - 09:11 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
yes, I said router but I mean coordinator side.
I understand that the "sending state" refers to "data sending to the computer" right?
That's why I put the "if(==8 " there, because that is the place where the router's frame is still intact.
or not?
Anyway, if I put the if(==8 on any other place, the result is the same, (no change of the led). |
|
|
| |
|
|
|
|
|
Posted: Mar 18, 2011 - 09:15 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
|
troyka wrote:
the place where the router's frame is still intact.
There is no router's frame there at all, that is where coordinator sends its own data.
Router's data is sent from APS_DataIndCoord() function. |
|
|
| |
|
|
|
|
|
Posted: Mar 18, 2011 - 09:43 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
ok, I see that now.
Edit -> Find in files ->APS_DataIndCoord only 3 ocurrences, and all definitions.
Looking at the parameter received by the function, APS_DataInd_t is defined on aps.h, but there is no temperature field in there.
And back to bitcloud manual, IND sands for indication, I don't think there is data inside right?
Where can I found the temperature value on the coordinator code? |
|
|
| |
|
|
|
|
|
Posted: Mar 18, 2011 - 09:51 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
|
troyka wrote:
ok, I see that now.
Edit -> Find in files ->APS_DataIndCoord only 3 ocurrences, and all definitions.
In original application it is in WSNCoord.c.
troyka wrote:
Looking at the parameter received by the function, APS_DataInd_t is defined on aps.h, but there is no temperature field in there.
Of course there is not, it is a general structure.
indData->asdu is a pointer to actual data, you need to typecast it to a pointer to AppMessage_t.
Like it is done in this case:
Code:
appSendMessageToUsart((AppMessage_t *)indData->asdu);
or in general it would be something like
Code:
AppMessage_t *msg = (AppMessage_t *)indData->asdu;
if (msg->meshbean.temperature == 88)
{
...
}
|
|
|
| |
|
|
|
|
|
Posted: Mar 18, 2011 - 10:29 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
Problem solved.
thank you |
|
|
| |
|
|
|
|
|
Posted: Mar 19, 2011 - 04:25 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
I have a conceptual doubt about the last.
Router 1 informs to the coordinator that the temp. is 88 degrees.
The coordinator receives that value.
Can Router 2 read that value too from the frame sended by router 1?
so the question is: if the frame was send in a unicast formast (p2p) the other router, is reading all the frames transmitted by air? (even the ones that are not destinated to him?)
I understand that router two must be reading all transmission from his PAN on his range, just in case one of that frames was destinated to him. But I don’t know if the protocol allow me to reach that frames…
Regards! |
|
|
| |
|
|
|
|
|
Posted: Mar 19, 2011 - 05:49 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
|
troyka wrote:
Can Router 2 read that value too from the frame sended by router 1?
No, you must use either broadcast or additional unicast message. |
|
|
| |
|
|
|
|
|
Posted: Mar 19, 2011 - 07:41 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
On wsndemo, if I change the message from router 1 to broadcast type, the application will continuing functioning?
I guess in this case, all nodes will be aware about the 88º, right?
I'm asking you before do nothing because it could take too much time to find out how to do that, and discover later that will not work... |
|
|
| |
|
|
|
|
|
Posted: Mar 19, 2011 - 08:05 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
|
troyka wrote:
On wsndemo, if I change the message from router 1 to broadcast type, the application will continuing functioning?
It should. Why not just try and see it for yourself? It will take less time then waiting for a reply. |
|
|
| |
|
|
|
|
|
Posted: Mar 20, 2011 - 04:03 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
If I change on INITIAL_DEVICE_STATE/APP_PROCESS
messageParams.dstAddress.shortAddress =ALL_DEVICES_IN_PAN_ADDR;
the router can never join to the network because enters in a loop Join -> Leaving ->Join...
I assume that some of the initial control frames must be unicast.
So, moved the broadcast to the "Sending device state"
Code:
case SENDING_DEVICE_STATE:
switch (event)
{
case APP_PROCESS:
visualizeAirTxStarted();
APL_WRITE_LOG(0x70)
messageParams.dstAddress.shortAddress = ALL_DEVICES_IN_PAN_ADDR;
APS_DataReq(&messageParams);
appDeviceState = WAITING_DEVICE_STATE;
break;
And the same result...
could be that after joined, the control frames are in broadcast mode and generate the same problem?
so, change it to only broadcast when the event is generated:
Code:
case SENDING_DEVICE_STATE:
switch (event)
{
case APP_PROCESS:
visualizeAirTxStarted();
APL_WRITE_LOG(0x70)
if(appMessage.data.meshbean.temperature==88){
messageParams.dstAddress.shortAddress = ALL_DEVICES_IN_PAN_ADDR;
}
APS_DataReq(&messageParams);
appMessage.data.meshbean.temperature=8;
appDeviceState = WAITING_DEVICE_STATE;
break;
In this case, that frame was never sent because the coordinator didn't show up the red led.
Tried to start the sniffer but wsndemo uses a CS_EXT_PANID and the sniffer software only a 2 bytes panID.
could you guide me here a little please? |
|
|
| |
|
|
|
|
|
Posted: Mar 20, 2011 - 04:11 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
|
troyka wrote:
could you guide me here a little please?
You need to start learning how to debug applications.
There is a reason why device leaves is not it? Why not trace the code find it?
In this case you need to disable APS ACKs, since you can't have them with broadcast messages: messageParams.txOptions.acknowledgedTransmission = 0; |
|
|
| |
|
|
|
|
|
Posted: Mar 20, 2011 - 08:32 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
|
alexru wrote:
You need to start learning how to debug applications.
Yes...I agree with you.
Turning on the led is not very useful in this case.
Tried using mkII and avrsimulator, but I can't control the program flow very well, in deed, I had seed breakpoints all over my code (I can count all of them with one hand) sometimes the cursor disappears, the micro is doing "who know what" and I have to stop manually after 10 minutes...
If you tell me "maybe that's the problem"...well...maybe that's right, but I never reach my code. Maybe bitcloud is to big to simulate that way.
I'm open mind to learn what it's necessary to debug this code... I will continue trying with simulator and led...any idea to improve debug is welcome |
|
|
| |
|
|
|
|
|
Posted: Mar 20, 2011 - 08:36 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
|
troyka wrote:
Tried using mkII and avrsimulator
Simulator is obviously useless here, BitCloud needs a real RF-chip.
troyka wrote:
I had seed breakpoints all over my code (I can count all of them with one hand)
Not a good idea either, there is only limited amount of hardware breakpoints, more than 2-3 breakpoints at a time will just slow things down.
It also may help to put
Code:
asm("nop");
on the line where you are planning to put a break point, this way compiler won't optimize it. |
|
|
| |
|
|
|
|
|
Posted: Mar 21, 2011 - 02:19 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
It's working now. The "nop" was helpful, and was necessary to add acknowledgedTransmission = 0 too.
Thank you about all the help provided.
My next step now is to move on to the zigbit modules.
Due to there is no 3290 on that architecture, I think It will be possible to debug using the serial port right? and that function "writelog" or similar that I have seen over there... |
|
|
| |
|
|
|
|
|
Posted: Mar 21, 2011 - 06:45 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
|
troyka wrote:
It will be possible to debug using the serial port right?
Sure, but I won't recommend using writeLog functions (since they don't do anything in release build).
I usually use this function, which I place in every file for simplicity:
Code:
static void write(uint8_t message)
{
static bool log_started = false;
if (!log_started)
{
UBRR1H = 0;
UBRR1L = 25;
UCSR1A = (1 << U2X1);
UCSR1B = (1 << TXEN1);
UCSR1C = (3 << UCSZ10);
log_started = true;
}
UDR1 = message;
while (!(UCSR1A & (1 << UDRE1)));
}
|
|
|
| |
|
|
|
|
|
Posted: May 07, 2011 - 10:55 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
Hi Alex,
Is it possible to enable pin change interrupts for port A on the raven board?
I added myself some extra code to support the PCINT on port A, but I reach a level where the stuff is defined at binary mode and I don't know how to proceed.
If it's not possible to add PCINT, how do you recommend me to add some extra 3 or 4 buttons to the board?
Maybe if there where joystick support I can solve my problem, but the joystick’s file is empty...
Thanks in advance |
|
|
| |
|
|
|
|
|
Posted: May 08, 2011 - 12:55 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
|
troyka wrote:
I added myself some extra code to support the PCINT on port A, but I reach a level where the stuff is defined at binary mode and I don't know how to proceed.
What do you mean by "binary level"? All the hardware depended stuff is open source. |
|
|
| |
|
|
|
|
|
Posted: May 08, 2011 - 04:00 PM |
|


Joined: Oct 28, 2009
Posts: 178
|
|
ok, then I'm making a mistake here...
When I step the code with breakpoints, I can see that HAL_EnableIrq(IRQ_0)puts a hi logic level on EIMSK bit 0.
The same if I use HAL_EnableIrq(IRQ_1) and IRQ_2.
After that, all the external interrupt works fine.
If I use IRQ_3, it seems that there is nothing defined here...(at least for the raven board)
so, looking down the code for de definition of IRQ_x I finally reach
extern IrqCallback_t IrqCallbackList[HAL_NUM_IRQ_LINES];
and cannot find the definition of IrqCallback_t that's why I thought it could be defined on a binary way. |
|
|
| |
|
|
|
|
|
Posted: May 08, 2011 - 04:05 PM |
|


Joined: Apr 15, 2009
Posts: 4861
Location: San Jose, CA
|
|
| It is defined in ./HAL/avr/atmega1284/common/include/halIrq.h. |
|
|
| |
|
|
|
|
|