Other Parts Discussed in Thread: CC1310, CC1350STK
Tool/software: Code Composer Studio
Hi.
I have written some code for CC1350STK based on rfWsnConcentratorOadServer_CC1310_LAUNCHXL_tirtos_ccs project.
I have 2 Tasks:
- One task is waiting for Semaphore, and when Semaphore_pend() is called it processes a loop before returning to wait for Semaphore in which it checks if there is data in some queues, and if there is it sends the data using a callback to another task
- Other task is waiting for Events, and when Event_pend() returns it processes the event and go back to Event_pend()
Task no.1 Code:
while (1) { Semaphore_pend(radioAccessSemHandle, BIOS_WAIT_FOREVER); .... while (!Queue_empty(rx_queue)) { prec = Queue_dequeue(rx_queue); notifyRxPacket(&(prec->data), prec->pkt_len); } /* Return to listen */ downstream_start(scpRadioProcessRxPacket); } } static void radioProcessRxPacket(uint8_t rssi, uint8_t ack_required, uint8_t length, void *data) { memcpy(&rx_rec.data, data, length); rx_rec.pkt_len = length; Queue_enqueue(rx_queue, &(rx_rec.elem)); Semaphore_post(radioAccessSemHandle); } static void notifyRxPacket(SCP_Packet *packet, uint8_t length) { if (packetReceivedCallback != NULL) { packetReceivedCallback(packet, length, latestRssi); } }
Task no.2 code:
{ .... while (1) { /* Wait for event */ uint32_t events = Event_pend(evtHandle, 0, TYPE_EVENT_ALL, BIOS_WAIT_FOREVER); if (events & EVENT_NODE_PACKET_RECIEVED) { ....... } } } static void packetReceivedCallback(SCP_Packet* packet, uint8_t length, int8_t rssi) { uint8_t packet_type = packet->header.packetType; memcpy(currentRxNode.address, packet->header.sourceAddress, MAC_ADDRESS_BYTES); currentRxNode.address_length = sizeof(packet->header.sourceAddress); currentRxNode.uptime = packet->keepalive_pkt.uptime; currentRxNode.battery = packet->keepalive_pkt.battery; currentRxNode.rssi = rssi; currentRxNode.fw_version = packet->keepalive_pkt.fw_version; Event_post(evtHandle, EVENT_NODE_PACKET_RECIEVED); }
Now, I put a breakpoint in the line:
prec = Queue_dequeue(rx_queue);
And I only reach it once only, when the first packet if sent from Node to the concentrator. No more stopping in debug there or in any other RX callback function.
I found out that when I comment out the call to packetReceivedCallback() or to notifyRxPacket() (notifyRxPacket is wrapper of packetReceivedCallback), then everything works fine, my debugging stops in prec = Queue_dequeue(rx_queue); for each received packet.
If I return the function to the code, I reach the breakpoint only on the first packet, and after that:
What could be the cause of this issue?
Kind Regards