Please correct me if I am wrong,
1. the function AppSendData() in the main program file (Peer2Peer.c) is used to send the data via the transceiver to the other transceiver at the receiving end.
2. the function appDataInd prints the data received from the radio on the host PC through UART.
How is the role of transmission divided between appSendData() and phy_datareq(). PHY_datareq seems to use the frame created in the nwk_tx.c program file, so I am assuming this is the frame that needs to be transmitted by the transceiver finally?
To hard code the output we implemented this method -
I, basically, hard coded the value of rx_data and fed it to both appsenddata() and sio2host_putchar(), and I expected this to print the data on the transmitting pc terminal (which it did) but it was not received by the receiving pc. Does this mean we would have to edit the frame_tx that I mentioned above in nkw_tx to alter the data being sent over the radio?
MY CODE -
int count;
static void APP_TaskHandler(void)
{
switch (appState) {
case APP_STATE_INITIAL:
{
appInit();
appState = APP_STATE_IDLE;
}
break;
case APP_STATE_IDLE:
break;
default:
break;
}
count++;
if(count%20001==1){
count=1;
}
if(count%20000==19999){
sio_rx_length = 5;
for (uint16_t i = 0; i < sio_rx_length; i++) {
rx_data=('A'+i); //put A,B,C
}
rx_data[sio_rx_length]=0x00;
//sio_rx_length = sio2host_rx(rx_data, APP_RX_BUF_SIZE); //until buffer is filled, 0 is returned. Buffer size is 20 bytes, defined in config.h
if (sio_rx_length) {
for (uint16_t i = 0; i < sio_rx_length; i++) {
sio2host_putchar(rx_data); //Echo back on the tx pc
if (appUartBufferPtr == sizeof(appUartBuffer)) //Send the packet when the buffer is full
{
appSendData();
}
if (appUartBufferPtr < sizeof(appUartBuffer)) //Append to the packet to be sent, the size of which is sizeof(appUartBuffer)
{
appUartBuffer[appUartBufferPtr++] = rx_data;
}
}
SYS_TimerStop(&appTimer);
SYS_TimerStart(&appTimer);
}