-
Notifications
You must be signed in to change notification settings - Fork 16
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
UDP sending quirks #14
Comments
After digging more deeply in the driver code, questions arise:
|
To continue previous comment : if I make a single But once again, it breaks the semantics of the UDP abstract class as initially provided.
But A possible solution would be to implement Then, rewrite The main problem with this solution is that it breaks the UDP class interface by introducing two new methods. |
Hi @drtutut As a first feedback, the High level API should follow the Arduino one : About the response time of the ISM43362 then yes I've already observed that. Do not hesitate to provide a PR with your proposal to fix/enhance this. This is a community project so all contribution are welcome. |
Thank you for your answer @fpistm I agree that the API has to follow the WifiUDP class you mention. I would be glad to contribute to the enhancement of this library, but I think it need further discussion before devising a solution. The problem for me is that its specification is very unclear, as is suggests that :
So first it suggests that one have to use this call sequence for every UDP datagram sent. At least this is my interpretation, as the words used in the specs of the API are particularly vague. Another problem with this API is that, while stating that In order to stick to the API, perhaps the way to go is
I fork the project and try to develop on this proposal basis. No guarantee to finish it before holidays. |
Agree that the API is not very precise and not mainly consistent Begin vs end. No worry for holidays. Have a nice one. |
Ok, here a first proposal. I paste a link pointing on my fork, I think it's too early to issue a pull request: https://github.com/drtutut/WiFi-ISM43362-M3G-L44 The With the current release, I'm able to execute sequences of The main evolutions are located in in
Then WiFiUdpST.(h|cpp) reimplements You are welcome to perform additional tests. |
We will check that after holidays, moreover we had input from Inventek about USB socket management. |
Trying to start a client connection on a sock already used failed and prevent to write other data. endPacket() allows to close a client connection properly if needed. Fixes stm32duino#14 Signed-off-by: Frederic Pillon <[email protected]>
Trying to start a client connection on a sock already used failed and prevent to write other data. endPacket() allows to close a client connection properly if needed. Fixes stm32duino#14 Signed-off-by: Frederic Pillon <[email protected]>
I've got time to check this issue,
This cause the firmware to never send data. I've made a new PR #16 which prevent this use case. Here the code which works with th PR #16 if (Udp.beginPacket(sendIP, 3001) == 1) {
size_t wr = Udp.write(Osc.getMessageBuf(), Osc.getMessageSize());
Serial.println(wr);
Udp.endPacket();
} Note that it should answer your issue with timing as |
Here is a description of a problem with UDP I managed to solve.
Board : STM32 Discovery B-L475E-IOT01A
ISM43362-M3G-L44 Firmware version: C3.5.2.3.BETA9
I am currently testing the sending of OSC (Open Sound Control) messages over UDP datagrams.
I use the LiteOSCParser library to build the buffer containing the message, and then send it via a
WiFiUDP
object and itswrite
method.My
setup()
function initialises the WiFi connection and everything works like charm.My
loop()
function is as follows :(I'm concious that
endPacket()
method does nothing for the moment but wait...When running this code, the first datagram is sent, and received by the application which listens
sendIP
andsendPort
but then, no subsequent UDP datagrams are sent.Some tracing shows that the first loop execution effectively writes 20 bytes (my message size), but the susequent writes just write zero bytes.
Then I realized that the sending process developped in the driver is based on a timeout design : if the data takes to much time to be sent, the
write
operation (theIsmDrvClass::ES_WIFI_SendResp
method indeed) is considered as faulty.beginPacked
starts a client connection (by callingES_WIFI_StartClientConnection(_sock)
), but this connection is never closed, and I suspect that after the firstwrite
it is no n longer valid (because of the timeout design).So I modified the
endPacket()
method, and added aDrvWiFi->ES_WIFI_StopClientConnection(_sock);
call into it, and voila ! It works now and my messages are written and received on the other side.But I have an aside question : despite a short 20ms delay at the end of the loop, the overall loop is very slow and, after a tracking of the problem, I managed to find that the
beginPacket()
call takes approximately 246ms, the sending of the datagram (`write) takes 160ms and closing the connection client takes 80ms. If somebody has an idea to shrink down these times, this would be great, because my future application needs lower transmission times in order to be useful (sending sensor data to control sound devices parameters).Regards
Eric
The text was updated successfully, but these errors were encountered: