Multi-Level Frequency Modulation#
MFM configuration routines.
Note
This feature is only supported on EFR32xG23 devices.
This feature can be used to directly control the TX interpolation filter input to allow for a more flexible frequency modulation scheme than the standard MODEM. When doing this, the MFM buffer is treated as an array of 8-bit signed data used as normalized frequency deviation to the SYNTH frequency to directly control the interpolation filter input. No support for frame handling, coding, nor shaping is supported. Only compatible with FSK modulations.
The functions in this group configure RAIL Multi-Level Frequency Modulation (MFM) hardware acceleration features.
To configure MFM functionality, the application must first set up a RAIL instance with RAIL_Init() and other setup functions. Before enabling MFM, a ping-pong buffer (called buffer0 and buffer1 below) must be configured via RAIL_SetMfmPingPongFifo() and populated with the initial buffer content. MFM is enabled by setting RAIL_TxDataSource_t::TX_MFM_DATA using RAIL_ConfigData() and is activated when transmit is started by RAIL_StartTx(). Once transmitting the data in the ping-pong buffers, RAIL will manage them so it looks like a continuous transmission to the receiver. Every time one of the ping-pong buffers has been transmitted, RAIL_EVENT_MFM_TX_BUFFER_DONE is triggered so the application can update the data in that buffer without the need to start/stop the transmission. RAIL_EVENT_MFM_TX_BUFFER_DONE can be enable with RAIL_ConfigEvents(). Use RAIL_StopTx() to finish transmitting.
#define MFM_RAW_BUF_WORDS 128
extern RAIL_Handle_t railHandle;
uint8_t txCount = 0;
uint32_t mfmPingPongBuffers[2][MFM_RAW_BUF_WORDS];
typedef struct mfmConfigApp {
RAIL_MFM_PingPongBufferConfig_t buffer;
RAIL_StateTiming_t timings;
RAIL_DataConfig_t dataConfig;
} mfmConfigApp_t;
static mfmConfigApp_t mfmConfig = {
.buffer = {
.pBuffer0 = (&mfmPingPongBuffers[0]),
.pBuffer1 = (&mfmPingPongBuffers[1]),
.bufferSizeWords = MFM_RAW_BUF_WORDS,
},
.timings = {
.idleToTx = 100,
.idleToRx = 0,
.rxToTx = 0,
.txToRx = 0,
.rxSearchTimeout = 0,
.txToRxSearchTimeout = 0
},
.dataConfig = {
.txSource = TX_MFM_DATA,
.rxSource = RX_PACKET_DATA,
.txMethod = PACKET_MODE,
.rxMethod = PACKET_MODE,
},
};
// Main RAIL events handler callback
static void RAILCb_Event(RAIL_Handle_t railHandle, RAIL_Events_t events)
{
// Increment TX counter
if (events & RAIL_EVENT_MFM_BUF_DONE) {
txCount++;
return;
}
}
}
void mfmInit(void)
{
// initialize MFM
uint32_t idx;
uint32_t *pDst0 = mfmConfig.buffer.pBuffer0;
uint32_t *pDst1 = mfmConfig.buffer.pBuffer1;
for (idx = 0; idx < (mfmConfig.buffer.bufferSizeWords / 4); idx++) {
pDst0[4 * idx + 0] = 0x755A3100;
pDst1[4 * idx + 0] = 0x755A3100;
pDst0[4 * idx + 1] = 0x315A757F;
pDst1[4 * idx + 1] = 0x315A757F;
pDst0[4 * idx + 2] = 0x8BA6CF00;
pDst1[4 * idx + 2] = 0x8BA6CF00;
pDst0[4 * idx + 3] = 0xCFA68B81;
pDst1[4 * idx + 3] = 0xCFA68B81;
}
RAIL_Status_t status;
status = RAIL_SetMfmPingPongFifo(railHandle, &mfmConfig.buffer);
assert(status == RAIL_STATUS_NO_ERROR);
status = RAIL_SetStateTiming(railHandle, &mfmConfig.timings);
assert(status == RAIL_STATUS_NO_ERROR);
mfmConfig.dataConfig.txSource = TX_MFM_DATA;
status = RAIL_ConfigData(railHandle, &mfmConfig.dataConfig);
assert(status == RAIL_STATUS_NO_ERROR);
// start transmitting
status = RAIL_StartTx(railHandle, 0, 0, NULL);
assert(status == RAIL_STATUS_NO_ERROR);
}
void mfmDeInit(void)
{
RAIL_Status_t status;
status = RAIL_StopTx(railHandle, RAIL_STOP_MODES_ALL);
assert(status == RAIL_STATUS_NO_ERROR);
mfmConfig.dataConfig.txSource = TX_PACKET_DATA;
status = RAIL_ConfigData(railHandle, &mfmConfig.dataConfig);
assert(status == RAIL_STATUS_NO_ERROR);
}
Modules#
RAIL_MFM_PingPongBufferConfig_t
Functions#
Set MFM ping-pong buffer.
Function Documentation#
RAIL_SetMfmPingPongFifo#
RAIL_Status_t RAIL_SetMfmPingPongFifo (RAIL_Handle_t railHandle, const RAIL_MFM_PingPongBufferConfig_t * config)
Set MFM ping-pong buffer.
[in] | railHandle | A handle of RAIL instance. |
[in] | config | A non-NULL pointer to the MFM ping-pong buffer configuration structure. |
Returns
Status code indicating success of the function call.
184
of file common/rail_mfm.h