ubxlib: Corrupted payload with uSockWrite
Environment
Module type: SARA-U201 Device type: Cell Network type: Cell Enable power pin: N/C (tied to 3v3) Power-on pin: N/C tied high VInt pin: N/C DTR power saving pin: N/C Transport type: UART Baud rate: 115200 CTS/RTS: N/C, pulled to ground with 2kΩ resistors
Platform: esp-idf Firmware: esp-idf v5.1.1 ubxlib: bd8a69efdecc6655fd2f6fcaebc9d63dac1f7571 Example: main_tls.c with no TLS, no credential checking.
Issue
When opening a TCP cellular socket, the payload data is corrupted by the AT+USOWR command (i.e. the beginning of my payload is corrupted and an AT+USOWR is appended and sent to my http server which corrupts my request).
I have a mod on my board which pulls CTS and RTS down to ground with 2kΩ resistors since they are not connected and serial communication over UART was not possible with those pins floating.
See similar issue here: https://portal.u-blox.com/s/question/0D52p00009JhO5VCAV/sara-r412m-sending-at-command-on-socket
Workaround
To fix this issue I had to disable UART power saving for modules that don’t use CTS/RTS and use Tx data to wakeup by commenting out the following:
//else clause in u_cell_pwr.c:987
else {
success = moduleConfigureOne(atHandle, "AT&K0",
U_CELL_PWR_CONFIGURATION_COMMAND_TRIES);
// RTS/CTS handshaking is not used by the UART HW, we
// can use the wake-up on TX line feature without any
// complications
if (uAtClientWakeUpHandlerIsSet(atHandle) &&
U_CELL_PRIVATE_HAS(pInstance->pModule,
U_CELL_PRIVATE_FEATURE_UART_POWER_SAVING)) {
uartPowerSavingMode = U_CELL_PWR_PSV_MODE_DATA;
}
(i.e. do not send AT+UPSV=1,1300, or likely any other derivative of that command).
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 20 (12 by maintainers)
I’m sane! Well, at least, thank you for the straw to clutch at. Having a working thing is a good start.
FYI, the main support guys for SARA-U201 are in Italy which is currently experiencing one of those European national holidays that are on a Thursday and so no-one will be in now until next week. If nothing has occurred to me by then I know who to contact though.
Yeah just, for your sanity, here is a working example where this time the power saving command was
AT+UPSV=0
sinceU_CFG_CELL_DISABLE_UART_POWER_SAVING
was defined.Wireshark:
My server:
Ubxlib AT log
Here’s the output, this time appended again.
So it seems to shuffle around a bit.
That looks quite sensible, UART power saving is enabled if nothing happens for 6 seconds. What we appear to be seeing, however, is only the periodic wake-up on paging and NOT the wake-up on a character arriving at the module.
FYI, integration manual:
https://content.u-blox.com/sites/default/files/SARA-G3-U2_SysIntegrManual_UBX-13000995.pdf
…page 58, “Wake-up via data reception”, is the detailed reference.
It says:
We have that,
AT&K0
being the bit that disables the flow control.I will continue thinking…