Texas Instrument CC1350 UART for RSSI signal strength

Hi,

i currently have an UARTecho that is working and the current code is as follows

else if(e & RF_EventRxEntryDone)
{
/* Successful RX */
bRxSuccess = true;

/* Get current unhandled data entry */
currentDataEntry = RFQueue_getDataEntry();
RSSIout = rxStatistics.lastRssi;

/* Handle the packet data, located at &(currentDataEntry->data):
* - Length is the first byte with the current configuration
* - Data starts from the second byte
*/
packetLength = *(uint8_t *)(&(currentDataEntry->data));
packetDataPointer = (uint8_t *)(&(currentDataEntry->data) + 1);

/* Copy the payload + status byte to the rxPacket variable */
memcpy(rxPacket, packetDataPointer, (packetLength + 1));

/* Check the packet against what was transmitted */
int16_t status = memcmp(returnCheck, rxPacket, checkLength);

if(status == 0)
{
/* Toggle LED1, clear LED2 to indicate RX */
PIN_setOutputValue(ledPinHandle, Board_PIN_LED1,
!PIN_getOutputValue(Board_PIN_LED1));
PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, 0);

UART_write(uart, &rxPacket, sizeof(rxPacket));
UART_write(uart, " ", 1);
}

However i want to additionally print the RSSI value of the packet i receive,

I have tried including the line UART_write(uart, &RSSIout, sizeof(RSSIout) below my existing UART_write lines

However it causes my TX and RX to stop transmitting after a few seconds

Anyone knows how to fix this?
> I have tried including the line UART_write(uart, &RSSIout, sizeof(RSSIout)
> below my existing UART_write lines
That seemed a reasonable thing to try.

> However it causes my TX and RX to stop transmitting after a few seconds
Does the thing at the other end understand that you're now sending RSSI information?

In particular, is rxPacket entirely printable characters, and is RSSIout something like a raw integer?

At lot of things complain if you send arbitrary binary data over a UART.

RSSIout is a 8 bit integer value! is there anyway to send a 8 bit sign integer over uart? and is it possible to send two bundles of data (the packet information and the RSSI signal strength) through Uart?
Try sending it as a formatted string, not a raw integer.
Hi salem thank you so much for the help so far, as i am really new to C++ how would i send the UART as a string?

Which part or UART_write(uart, &RSSIout, sizeof(RSSIout) would i need to change
I'm going to go with C, which is what your code looks like, and is far more likely to be what you're using on small devices without operating systems.

1
2
3
char buff[10];
snprintf(buff,sizeof(buff),"%d ",RSSIout);
UART_write(uart, buff, strlen(buff));


If you don't have snprintf.
1
2
3
char buff[10];  // take a chance that 10 is always enough
sprintf(buff,"%d ",RSSIout);
UART_write(uart, buff, strlen(buff));


If you have no formatted printing, build your own.
1
2
3
4
5
const char *lut = "0123456789abcdef";
char buff[4] = ".. ";
buff[0] = lut[ (unsigned)(RSSIout >> 4) & 0xf ];
buff[1] = lut[ (unsigned)(RSSIout >> 0) & 0xf ];  // yes, >>0 is a no-op, it's pretty though
UART_write(uart, buff, strlen(buff));

Yes, this sends it in hex rather than decimal.
If you want decimal, and this is your only option, consider it an easy exercise.


It works!!!!! thank you so much salem! hope you have a great day ahead!
Hi salem sorry to trouble again. now that i have the RSSI value, is it possible to UART_write 2 different information? i am now unable to

char buff[10]; // take a chance that 10 is always enough
sprintf(buff,"%d ",RSSIout);
UART_write(uart, buff, strlen(buff));
UART_write(uart, &Rxpacket, sizeof(rxpacket);

the display only shows

char buff[10]; // take a chance that 10 is always enough
sprintf(buff,"%d ",RSSIout);
UART_write(uart, buff, strlen(buff));

is it possible to display both of this information in the same line?
I've no idea about the mysteries of your 'display', or what might be in your Rxpacket .

Registered users can post here. Sign in or register to post.