-
Notifications
You must be signed in to change notification settings - Fork 82
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
Using uSockWrite for UDP #200
Comments
Hi, and thanks for posting.
You have created a UDP socket with uSockCreate(); at that point this is just a local socket (let's call it A), it is not connected to anything. With that done, you can either connect that socket to something (let's call this B) using uSockConnect() and use uSockWrite() to send data over the connected socket to B, or you can not bother connecting the socket to B and instead call uSockSendTo(), which takes the address of B as a parameter, and send it that way. This is normal BSD sockets operation, I think.
-1 is the standard BSD sockets "error" return value for everything: to see why a |
Not that this will be a cause of the -1 error but I thought I should point it out: the code you pasted in shows a call to uCellSockBlockingSet(); it says in the function description "this function is provided for compatibility purposes only: this socket implementation is always non-blocking". Blocking is done at the |
The second call of |
Hmm, odd, I was expecting a positive number but, whatever, I assume that is U_SOCK_EIO, and so code execution is probably about here: Line 1284 in a8ed25d
...and the module has not accepted the |
The debug output loosk as following when sending crashes:
One step bevore, the sending of data worked finde:
Not much information. |
Could you post the whole |
|
Thanks, looks like this might be a SARA-R422? How is the module being powered? The interesting thing in the log is the On a side note, you are requesting 3GPP power saving, though it is not being granted by the network as you have a roaming SIM, so that shouldn't be an issue, but if it were granted you might, of course, expect the module to power-off like this. |
Yes it is a SARA-R422 i measured V_INT - somehow it glitches sometimes for about 30ms to low. very strange. when we are waiting for the response from the module, it always happens. i exchanged the power supply for 3.3V for the module with a powerfull external supply (able to deliver up to 6A) -> still the same issue how to disable 3GPP power saving? actualy we dont need this. |
Very strange, seems likely to be transmit-peak-current-related, rather than average-current-related, IYSWIM. I'm no HW guy, unfortunately, all I could suggest is having a good read through the quite lengthy section 1.5.1 of the SARA-R4 system integration manual. EDIT: note also that antenna matching has an effect on the peak current consumption; that may be worth checking.
Oops, sorry, I misread the debug output, those commands are just setting up a notification for 3GPP power saving events, they aren't actually switching 3GPP power saving on, so it is OK. |
So far so good. Things are working. But - if we lose cellular connection and have to reconnnet we see sometimes the following
The returned socket in the Look like a discrepancy between the host memory and the acutal ip stack on the module itself..
|
Hi again: the socket descriptor returned by uSockCreate() is the descriptor used by the I will update the description of EDIT: see e46ddee. |
I'm going to close this one now: please feel free to re-open it if there is more to discuss, or open a new issue. |
What is the intenioned way to use the uSockWrite() for a UDP Packet to be sent?
Sending data with
uSockWrite()
only works once. After the first succescul sendint, uSockWrite returns always -1? why does the socket have to be "connected" even though I only want to send an udp packet?Thanks for your support.
The text was updated successfully, but these errors were encountered: