Other Parts Discussed in Thread: CC3120, CC31XXEMUBOOST
Hello,
I want to send a burst of three messages in transceiver mode using sl_Send(). However, rapidly calling it only lets the first one through even though sl_Send() correctly returns the number of bytes sent for all three. After this, slcb_SockEvtHdlr fires with
{Event = 1, SocketAsyncEvent = {SockTxFailData = {Status = -9, Sd = 0 '\000', Padding = 17 '\021'}, SockAsyn cData = {Sd = 247 '\367', Type = 255 '\377', Val = 4352, pExtraInfo = '\000' }}}
where Event = 1 corresponds to SockTxFailData according to sl_socket.h. What does status = -9 mean?
If I add a delay between the sl_Send()s all three messages show up in Wireshark.
Here is the code I'm running
sl_Start(0, 0, 0);
i16 status;
status = sl_WlanPolicySet( SL_WLAN_POLICY_CONNECTION, SL_WLAN_CONNECTION_POLICY(0, 0, 0, 0), NULL, 0);if (status) { debug_printf("Failed to set WLAN connection policy\r\n"); }
status = sl_WlanDisconnect();
if (status) { debug_printf("WLAN already disconnected\r\n"); }
short socket = sl_Socket(SL_AF_RF, SL_SOCK_RAW, 1);
if (socket < 0) { debug_printf("Failed to created RAW socket\r\n"); }
for (u8 i = 0; i < 3; ++i) {
// Modify the message slightly here
short status = sl_Send(socket, message->buffer, message->length, SL_WLAN_RAW_RF_TX_PARAMS(1, SL_WLAN_RATE_6M, 13, SL_WLAN_LONG_PREAMBLE));
if (status != message->length) { debug_printf("Error when sending raw message: %d\r\n", (int) status); }
// for (u32 j = 0; j < 1000000; ++j);
}
sl_Close(socket);
sl_Stop(0xffff);
The only debug_printf that shows up is "WLAN is already disconnected". If I uncomment the inner for loop all messages are sent.
It seems sl_Send() only blocks until data is sent from the host MCU to the CC3120, not until the CC3120 has actually sent it over the air. Thus, it is busy when I send it the second and third message.
I'm running this on an STM32L412 without any RTOS and my application is power sensitive. I want to send these messages as fast as possible then go back to sleep. Any help would be greatly appreciated.