Skip to content

Commit a47113d

Browse files
grochurlubos
authored andcommitted
samples: bluetooth: DTM (FEM) fix assert when setting tx power by NCD
Fix assertion in the direct_test_mode sample working with FEM, where after setting the Tx power from the nRF Connect for Desktop app the FW would try setting power through FEM API passing the encoded power value as the "channel number" argument. The vendor-specific command used by the app uses the "channel" field for passing the parameter value and the FW incorrectly recorded that value in it's static data. Additionally clarified available power values in the FEM section of the sample README.rst file and removed unused defines. Ref. NCSDK-34026 Signed-off-by: Michał Grochala <[email protected]>
1 parent b2d46cb commit a47113d

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

samples/bluetooth/direct_test_mode/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ Vendor-specific commands can be divided into different categories as follows:
284284
* If the **Length** field is set to ``1`` (symbol ``CARRIER_TEST_STUDIO``), the field value is used by the nRFgo Studio to indicate that an unmodulated carrier is turned on at the channel.
285285
It remains turned on until a ``TEST_END`` or ``RESET`` command is issued.
286286
* If the **Length** field is set ``2`` (symbol ``SET_TX_POWER``), the **Frequency** field sets the TX power in dBm.
287-
The valid TX power values are specified in the product specification ranging from –40 to +4, where ``0`` dBm is the reset value.
287+
The valid TX power values are specified in the product specification of the SoC used, where ``0`` dBm is the reset value.
288288
Only the six least significant bits will fit in the **Length** field.
289289
The two most significant bits are calculated by the DTM module.
290290
This is possible because the six least significant bits of all valid TX power values are unique.

samples/bluetooth/direct_test_mode/src/dtm.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ BUILD_ASSERT(NRFX_TIMER_CONFIG_LABEL(ANOMALY_172_TIMER_INSTANCE) == 1,
184184
#define PACKET_BA_LEN 3
185185
/* CTE IQ sample data size. */
186186
#define DTM_CTE_SAMPLE_DATA_SIZE 0x52
187-
/* Vendor specific packet type for internal use. */
188-
#define DTM_PKT_TYPE_VENDORSPECIFIC 0xFE
189-
/* 1111111 bit pattern packet type for internal use. */
190-
#define DTM_PKT_TYPE_0xFF 0xFF
191187

192188
/* Maximum number of payload octets that the local Controller supports for
193189
* transmission of a single Link Layer Data Physical Channel PDU.
@@ -1890,8 +1886,10 @@ static int dtm_vendor_specific_pkt(uint32_t vendor_cmd, uint32_t vendor_option)
18901886
}
18911887

18921888
/* Not a packet type, but used to indicate that a continuous
1893-
* carrier signal should be transmitted by the radio.
1889+
* carrier signal should be transmitted by the radio on the
1890+
* channel indicated by the 'option' field.
18941891
*/
1892+
dtm_inst.phys_ch = vendor_option;
18951893
radio_prepare(TX_MODE);
18961894
nrf_radio_fast_ramp_up_enable_set(NRF_RADIO, IS_ENABLED(CONFIG_DTM_FAST_RAMP_UP));
18971895

@@ -2402,9 +2400,15 @@ int dtm_test_transmit(uint8_t channel, uint8_t length, enum dtm_packet pkt)
24022400

24032401
dtm_inst.packet_type = pkt;
24042402
dtm_inst.packet_len = length;
2405-
dtm_inst.phys_ch = channel;
24062403
dtm_inst.current_pdu = dtm_inst.pdu;
24072404

2405+
/* 'channel' may be used for different purposes if the packet
2406+
* is vendor-specific
2407+
*/
2408+
if (pkt != DTM_PACKET_VENDOR) {
2409+
dtm_inst.phys_ch = channel;
2410+
}
2411+
24082412
/* Check for illegal values of m_phys_ch. Skip the check if the
24092413
* packet is vendor specific.
24102414
*/
@@ -2417,7 +2421,7 @@ int dtm_test_transmit(uint8_t channel, uint8_t length, enum dtm_packet pkt)
24172421
/* Check for illegal values of packet_len. Skip the check
24182422
* if the packet is vendor spesific.
24192423
*/
2420-
if (dtm_inst.packet_type != DTM_PKT_TYPE_VENDORSPECIFIC &&
2424+
if (dtm_inst.packet_type != DTM_PACKET_VENDOR &&
24212425
dtm_inst.packet_len > DTM_PAYLOAD_MAX_SIZE) {
24222426
/* Parameter error */
24232427
return -EINVAL;

0 commit comments

Comments
 (0)