Hello,
I'm writing CC1110 software based on
"CC1110_CC2510 Example Software Supported on IAR Embedded Workbench (Rev. B) (swrc085b)"
and what i want to do is,
(1) Let CC1110 device as RX mode when boot up
(2) When CC1110 device receive packet from another peer, transition to TX mode and send response packet to peer
(3) After send packet, transition back to RX mode again
for this purpose, I write function below and make it called whenever CC1110 device receive packet
but seems CC1110 device won't send packet.
I'd check that CC1110 device receive packet with no problem but not able to send packet. So I can say (1), (3) is okay but (2) is not.
Could you check code below and let me know if there's problem?
Thanks in advance!
void PacketSend(void)
{
UINT8 idx;
// (1) transition to tx mode and send packet
mode = RADIO_MODE_TX;
RFST = STROBE_TX;
dmaRadioSetup(RADIO_MODE_TX);
// Configure interrupt for every time a packet is sent
HAL_INT_ENABLE(INUM_RF, INT_ON); // Enable RF general interrupt
RFIM = IRQ_DONE; // Mask IRQ_DONE flag only
INT_GLOBAL_ENABLE(INT_ON); // Enable interrupts globally
// Construct the packet to be transmitted in buffer
radioPktBuffer[0] = PACKET_LENGTH; // Length byte
radioPktBuffer[1] = (BYTE) (NETWORK_ID_KEY>>8); // Network identifier
radioPktBuffer[2] = (BYTE) NETWORK_ID_KEY;
// radioPktBuffer[3:6] = 4 byte packet sequence number, written later
// Fill rest of payload with dummy data. Radio is using data whitening.
for (idx = 3; idx <= PACKET_LENGTH; idx++) {
radioPktBuffer[idx] = 0xCC;
}
RFST = STROBE_IDLE;
halWait(1);
RFST = STROBE_CAL;
halWait(1);
// Send packet
DMAARM |= DMAARM_CHANNEL0; // Arm DMA channel 0
RFST = STROBE_TX; // Switch radio to TX
// Wait until the radio transfer is completed,
// and then reset pktSentFlag
while(!pktSentFlag);
pktSentFlag = FALSE;
// (2) transition to rx
mode = RADIO_MODE_RX;
dmaRadioSetup(RADIO_MODE_RX);
// Configure interrupt for every time a packet is sent
HAL_INT_ENABLE(INUM_RF, INT_ON); // Enable RF general interrupt
RFIM = IRQ_DONE; // Mask IRQ_DONE flag only
INT_GLOBAL_ENABLE(INT_ON); // Enable interrupts globally
RFST = STROBE_IDLE;
halWait(1);
RFST = STROBE_CAL;
halWait(1);
// Start receiving
DMAARM = DMAARM_CHANNEL0; // Arm DMA channel 0
RFST = STROBE_RX; // Switch radio to RX
}