I now need to calculate the value of RSSI. According to the user manual, I need to query the RX TUNE EN bit value in DGC CFG. My current operation is to use RX_TUNE_STATUS=dwt_read32bitreg(DGC_CFG_ID) after receiving;
I tried to read the DGC_CFG 32-bit data, but I failed, the data read is 0x19c7e5e5, but the manual only has 16 valid bits, the higher 16 bits should be null.
So I went online to ask for help on how to correctly read the value of this register.
To correctly read the value of the DGC_CFG register, you will need to use a bit mask to extract the relevant bits from the 32-bit value that you read. You can do this by using the bitwise AND operator in your code.
For example, if you want to extract the RX TUNE EN bit from the DGC_CFG register, you can use a bit mask with a value of 0x0001. This will allow you to extract the value of the RX TUNE EN bit from the 32-bit value that you read.
Here is some example code that shows how you can extract the RX TUNE EN bit from the DGC_CFG register:
// Read the value of the DGC_CFG register
uint32_t dgc_cfg = dwt_read32bitreg(DGC_CFG_ID);
// Extract the RX TUNE EN bit using a bit mask
uint32_t rx_tune_en = dgc_cfg & 0x0001;
This will allow you to extract the value of the RX TUNE EN bit from the DGC_CFG register and store it in the rx_tune_en variable. You can then use this value as needed in your code.
I hope this helps! Let me know if you have any other questions.