Hi everyone,
I'm facing a problem that some/most of you might already have overcome.
Hardware: CC1110 EVK (Four) and CC-Debugger (Two)
Software: SimpliciTI 1.1.1 and IAR workbench
Basically, I want to communicate between two unlinked devices using IOCTL calls. More specifically, I've tried using SMPL_Ioctl(IOCTL_OBJ_RAW_IO, IOCTL_ACT_WRITE, voidWritePointer) for transmission and
SMPL_Ioctl(IOCTL_OBJ_RAW_IO, IOCTL_ACT_READ, voidReadPointer) for reading. Mind you that I've initialized the voidWritePointer with the necessary fields like address of the device I want to send the message to, port on which I wish to send, length and message. Initialized the voidReadPointer with address of the device I'm expecting the message from, port on which the sending device is sending the message on.
I have a packet sniffer so I can see that transmission of the packet with the payload is happening as it should, with the correct destination address. But keeping watch on the the reading device with breakpoints, I always end up getting SMPL_NO_FRAME as the return of the SMPL_Ioctl(IOCTL_OBJ_RAW_IO, IOCTL_ACT_READ, voidReadPointer) call.
These calls work fine with the user broadcast address (0x3F) but I want to use a different port address. I've tried with port addresses 0x20 and 0x10 but both return the SMPL_NO_FRAME.
Digging into the SMPL_Ioctl(IOCTL_OBJ_RAW_IO, IOCTL_ACT_READ) I saw that it uses the nwk_rawReceive() which in turn calls the nwk_retrieveFrame(). By using breakpoints and stepping, I made the following observations:
- The network address that I specified in the SMPL_Ioctl(IOCTL_ACT_READ) call, meaning the address of the device I want to read from, is not regarded anywhere. ONLY the port address is assigned in the nwk_rawReceive().
- Inside nwk_retrieveFrame(), the function nwk_QfindOldest() is called to see if there is any frame in the queue for the specified port. This where the function throws back (returns) the SMPL_NOFRAME
I feel that I am missing something very basic and hope that somebody might take the liberty to point it out.
Thanks!
Yash Darad
EDIT: I realized that I had not attached the initialization routines.
snippet from receiving routine
uint8_t rxMsg[MAX_APP_PAYLOAD], len, hopCount;
uint8_t txMsg[MAX_APP_PAYLOAD];
smplStatus_t status;
addr_t devAddr;
addr_t *pDevAddr;
pDevAddr = &devAddr;
void *rxRawMsg;
ioctlRawReceive_t* pRxReqd;
ioctlRawReceive_t rxReqd;
pRxReqd = &rxReqd;
uint8_t *pLen;
pLen = &len;
uint8_t *pHopCount;
pHopCount = &hopCount;
devAddr.addr[0] = 0x79; //Address of device I want to listen from
devAddr.addr[1] = 0x56;
devAddr.addr[2] = 0x34;
devAddr.addr[3] = 0x12;
pRxReqd->addr = &devAddr;
//pRxReqd->port = SMPL_PORT_NWK_BCAST;
pRxReqd->port = 0x10;
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_RXON, 0); //Turn on Radio
NWK_DELAY(100); //wait for sometime...
while(1)
{
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_RXON, 0); //Turn on Radio
NWK_DELAY(100); //wait for sometime...
rxRawMsg = (void*)pRxReqd;
status = SMPL_Ioctl(IOCTL_OBJ_RAW_IO, IOCTL_ACT_READ, rxRawMsg);
}
Snippet from Transmission routine
uint8_t rxMsg[MAX_APP_PAYLOAD], len, hopCount, i = 0, j = 5;
uint8_t txMsg[MAX_APP_PAYLOAD];
ioctlRawSend_t txReqd;
ioctlRawSend_t *pTxReqd;
pTxReqd = &txReqd;
addr_t *pDevAddr;
addr_t devAddr;
pDevAddr = &devAddr;
void *pVoidObject;
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_RXON, 0); //Turn on Radio
NWK_DELAY(100); //wait for sometime...
while(1)
{
txMsg[0] = JOIN_ME;
devAddr.addr[0] = 0x97; //Address of device I want to send message to
devAddr.addr[1] = 0x56;
devAddr.addr[2] = 0x34;
devAddr.addr[3] = 0x12;
pTxReqd->addr = &devAddr;
pTxReqd->port = 0x10;
pTxReqd->msg = txMsg;
pTxReqd->len = 1;
pVoidObject = pTxReqd;
//pTxReqd->port = SMPL_PORT_NWK_BCAST; //Not sure if port number is required...
SMPL_Ioctl(IOCTL_OBJ_RAW_IO, IOCTL_ACT_WRITE, pVoidObject);
}
Ideas will be much appreciated.