Hi all,
I used Proximity sample code to connect with a smartphone, then here comes two value which in IoT Toolbox app: RSSI and Tx Power. The rssi value keeps changing which seems normal, but the tx power is always zero.
I have two questions to ask,
1. How do I print the rssi value on the console to monitor it?
Here is my code,
static void RssiMeasurementTimerCallback(deviceId_t peerDeviceId, gapConnectionEvent_t* pConnectionEvent)
{
(void)Gap_ReadRssi(peerDeviceId);
int8_t rssi_val;
rssi_val = pConnectionEvent->eventData.rssi_dBm;
PRINTF("rssi: %d\n",rssi_val);
}
I set a timer to trigger it, but the value is 0 all the time.
2. Why the tx power value is always zero?
Thank you.
Solved! Go to Solution.
Hi @Lincoln,
Please look at the next API and the comments that we provide.
* \remarks The result is contained in the gConnEvtRssiRead_c connection event. The RSSI
* value is a signed byte, and the unit is dBm. If the RSSI cannot be read, the gConnEvtPowerReadFailure_c
* connection event is generated.
********************************************************************************** */
#define Gap_ReadRssi(deviceId)
Regards,
Mario
Hi @Lincoln,
I hope you are doing great.
1. Be sure that the debug pins are enabled for the Print API.
/* Init hardware */
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();
2. Please look at the next line of the code. The TX Power is not changing, it will depend on the setup that you have.
static txsConfig_t serviceTxPowerConfig = {(uint16_t)service_tx_power, 0x00};
Regards,
Mario
Hi @mario_castaneda ,
Thanks for your advise, but here comes another problem. After I add the init hardware code about Print API and run it again, it shows this fault below when i connected to IoT Toolbox, then it loss of connection immediately.
(My code is attached below)
Hi @Lincoln,
You have to initialize the clock and the UART pins. Please look at the wireless uart example or the QPPS as a reference for this setup.
Regards,
Mario
Hi @mario_castaneda,
Thank you for the response, the fault issue is resolved and the connection is stable. As I ask previously, I want to monitor the Rssi value on the console, I checked this function: Gap_ReadRssi(peerDeviceId) is working successfully, but it is always printing Rssi value as zero on the console.
Is the rssi value would be updated automatically or i have to trigger
Hi @Lincoln,
Please look at the next API and the comments that we provide.
* \remarks The result is contained in the gConnEvtRssiRead_c connection event. The RSSI
* value is a signed byte, and the unit is dBm. If the RSSI cannot be read, the gConnEvtPowerReadFailure_c
* connection event is generated.
********************************************************************************** */
#define Gap_ReadRssi(deviceId)
Regards,
Mario