-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SARA-R4] MQTT publisher not working - Impossible to connect to broker #21764
Comments
If I understood correctly from report at mailing list, the system worked ok in 1.14 |
Have a look at the error "NET_SOCKET_OFFLOAD must be configured for this driver" Billy..
|
You can understand it like that because I previously worked on zephyr 1.14.1 and I cherry-picked commits to be able to have UBLOX-SARA-R4 driver. This worked pretty good and I did MQTT communications on any MQTT broker (Orange-liveobject, our own mosquitto broker on infomaniak server, mosquitto.org, ...) |
From my point of view LOG_ERR("NET_SOCKET_OFFLOAD must be configured for this driver"); is not really important because this should only create UDP socket what is not necessary for our need. |
@WilliamGFish , @jukkar , @mike-scott I just tried to revert the 2 following commits: It is now working so I am pretty sure that regression come from this one (ebf6520#diff-cb3c7d77935fa5df6ccb74a1c5e050ba) thanks again for your help on this case. |
Oh no; now I'm looking at this with the U201 version of a Boron board and have found a few odd errors. The change was moving to the MODEM_CONTEXT which will effect all AT command driven devices. Billy.. |
At a quick glance, it looks like what you have reverted was the change to SOCKET_OFFLOAD back to NET_OFFLOAD, which had been working previously. |
I also think so. |
I put some DBG hex-dump calls in the modem driver and am concerned with the number of rapid calls to the MQTT server, as seen in your message board post. This appears to be the potential issue or it relates to the polling function which the MQTT client relies on to understand the server connection messages. More digging tomorrow. |
@mike-scott Would it not make sense to revert to using the net (MODEM_RECEIVER) rather than socket offloading (MODEM_CONTEXT) for future portability.? The creation of a generic AT modem context was to minimise duplicate code and future maintenance but we appear to be having issues with basic connect tests. |
DNS isn't working either on the v2.0 branch, maybe the same reason?
An alternative to offloading for these modems would be +CMUX multiplexing and PPP. The current solution works well with UDP but not for TCP, because the modem handles the TCP acks and checksums and it doesn't know about bytes lost on the modem UART. |
Sorry for the noise; the DNS calls are just missing in modem_socket_offload. Will try to fix. |
Ok thanks for this |
@gpaquet85 @weinholtendian @WilliamGFish |
@WilliamGFish I don't think we need to revert back to modem receiver. I think there's a few bugs that need to be ironed out. |
@mike-scott I'm confused as to the move to SOCKET_OFFLOAD from NET_OFFLOAD. It to me seems better to standardise on the NET_OFFLOAD model, as we are handing off the networking to be managed by the 'modem'. |
The
Where SOCKET_OFFLOAD offers all of these in a POSIX-ike API:
In addition to the extra APIs, the memory model for the socket layer is easier to use and sometimes less memory intensive because you can copy buffers when the user calls |
I have a branch with various fixes for the SARA driver, including a basic The changes should be verified with SARA R410M and SARA U201. @mike-scott Does SOCKET_OFFLOAD mean that we can't use Zephyr's mbedTLS anymore, that we should ask the modem to configure TLS for us? If that is the case then I think we have a problem, because AFAICT the modem doesn't support DTLS, which means no security for LwM2M. |
Worst case would be using Zephyr's TLS implementation via the setsockopt layers. The other idea I had was to let the modem driver implementation choose the better of NET_OFFLOAD or NET_SOCKETS_OFFLOAD. |
@weinholtendian I also have a DNS patch for SARA-R4 which I never pushed upstream due to the need for newer firmward on the R410M :/ That's the old version, I've been play testing it with non-LwM2M use-cases and realize that it needs a bit of patching up. |
@weinholtendian If you don't mind I'd like to pull in some of your patches and add them to this: #22149 |
@mike-scott Go right ahead. BTW, do we deal anywhere with the 1024 byte (512 hex) payload limit per AT command? MQTT is TCP and is more sensitive to this (although it is probably not what happened here). Suppose the modem says "+UUSORD: 0,1500". Then we can use "AT+USORD=0,1024" followed by "AT+USORD=0,476" when not using hex mode. I had a quick look and didn't see anything to handle this. |
Hi, I issued a PR that deals with the 1024 byte (512 hex) limit when sending, and that reads the number of bytes sent as reported by the modem: It shouldn't be difficult to do something similar when receiving. |
@hwilmers Thank you for the patches! I'm testing a recv() patch locally. May I cherry-pick your patches into my "fixes" PR? #22149 |
@mike-scott of course - just go ahead and cherry pick. |
@gpaquet85 @WilliamGFish @weinholtendian @hwilmers This includes a few patches from @weinholtendian @hwilmers. And a few resulting patches for MQTT: Let me know how it goes. |
Describe the bug
I see an issue when I try to use MQTT Publisher through SARA R4 modem driver. Indeed, it is impossible to conenct to MQTT server/broker.
I checked that Network connection was ok.
To Reproduce
Compiling https://github.com/zephyrproject-rtos/zephyr/tree/master/samples/net/mqtt_publisher::
Expected behavior
When tryin to connect to MQTT broker, I always have following issue:
MQTT connect failed -111
So it is impossible to communicate.
Impact
No MQTT communication on my board which is protocol chosen for our need by our customer.
Screenshots or console output
Environment (please complete the following information):
Additional context
I have follwoing traces when I snif UART bus
AT+USOCR=6
+USOCR: 0
OK
AT+USOCO=0,"83.166.154.87",1883
OK
AT+USOWR=0,30
@
+USOWR: 0,30
OK
AT+USOWR=0,30
@
+USOWR: 0,30
OK
AT+USOWR=0,30
@
+USOWR: 0,30
OK
+UUSORD: 0,4
AT+USOWR=0,30
@
+CME ERROR: 3
The text was updated successfully, but these errors were encountered: