This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Links,
Let's break down your code and the potential issues, especially considering the EMIF access to an FPGA.
Analysis of Your Code:
tx_cfg()
: This looks like a standard setup for the RCL (Radio Core Library). RCL_Schedule_Now
means the command should execute immediately. txCallback
is set, but your tx_service
routine uses RCL_Command_pend
, which is a blocking call, so the callback might not be the primary mechanism for completion in this specific flow.
tx_service()
:
RCL_Command_submit(rclHandle, &rclPacketTxCmdGenericTx);
RCL_Command_pend(&rclPacketTxCmdGenericTx);
RCL_Command_pend
will block the current FreeRTOS task until the RF command completes or times out internally. If the RF command fails or takes an unusually long time, this pend
call will be the source of your delays. You are not checking the return value of RCL_Command_pend
, which is crucial for understanding why it might be delayed or failing.usleep(PACKET_INTERVAL);
usleep()
is typically a busy-wait function or a very coarse delay that is not FreeRTOS-aware. In a FreeRTOS environment, you should almost always use vTaskDelay()
or vTaskDelayUntil()
for task delays. If PACKET_INTERVAL
is 1 second (1,000,000 microseconds), usleep
will block the CPU for that entire duration, preventing other tasks from running efficiently and potentially causing your observed delays if the RF transmission itself is also delayed.Potential Causes and Solutions:
Given your description and the code, here are the most likely culprits and debugging steps:
1. Incorrect Delay Mechanism (usleep
)
usleep
is not designed for FreeRTOS and can cause significant scheduling issues and CPU hogging. If the RF transmission fails or is delayed, the usleep
will still add its full duration, leading to *** delays.usleep(PACKET_INTERVAL);
with a FreeRTOS-aware delay.
PACKET_INTERVAL
in milliseconds (e.g., 1000
for 1 second).vTaskDelay(pdMS_TO_TICKS(PACKET_INTERVAL));
pdMS_TO_TICKS()
converts milliseconds to FreeRTOS ticks.2. RCL_Command_pend
Blocking/Failure
pend
waits for a long time, it will cause your observed delays.RCL_Command_pend
. It will tell you if the command succeeded, failed, or timed out.
RCL_CommandStatus_t cmdStatus = RCL_Command_pend(&rclPacketTxCmdGenericTx); if (cmdStatus != RCL_CommandStatus_Done) { // Log or display the error status Display_printf(display, 0, 0, "RF Tx Failed! Status: %d\n", cmdStatus); // Consider error recovery or re-submission } else { // RF Tx successful }
RCL_Command_pend
have a timeout parameter? If so, use it to prevent indefinite blocking. If it times out, you know the RF command didn't complete within the expected time.txCallback
more actively. Submit the command, then the task can do other work or vTaskDelay
for a short period, and the callback can signal completion (e.g., via a FreeRTOS semaphore or queue). This makes the task non-blocking.3. EMIF/FPGA Interference (The most likely cause given your specific mention)
This is where it gets tricky. The TMS570LS3137 is a complex MCU, and EMIF access can conflict with other system operations.
Bus Contention:
RCL_Command_pend
to block for longer.Memory Protection Unit (MPU) Configuration:
Clocking Issues:
FPGA Responsiveness:
--