Core UDP not working in Semi-Auto mode without cloud/internet

Hi everybody,

i try to send UDP packages with my old spark core. When i’m in auto mode, everything works fine. If i set the core to semi_auto the core crashes after trying todo some UDP stuff ( begin() works but it failed when i try to send a package, doesnt matter if it is send to or to
i read several threads about the issue while sending broadcast messages. the mentioned solution “insert a” does not solve my problem. core still stucks.

do i have to go to manual mode to get it working?
i thought i updated my core via “particle flash --factory tinker / particle flash --usb cc3000 / particle flash --usb tinker” but i will try it again this afternoon. is there a way to get the version of the cc3000 fw?

hope someone can help me.

Are you calling WiFi.connect() and wait for WiFi.ready() before you engage in UDP stuff?

Showing your code could save you getting these questions :wink:

yep, connect to WiFi works fine and also ready etc works (getting correct localIp, gatewayIp, etc). i’m also waiting 1sec after i got a successful WiFi.ready() but still got the issue. Currently i’m not at home, will paste some code in around 1h


  • Updated my core, still same failure
  • Tried manual mode, some failure. only working in auto mode

parts of my code:



  while (!WiFi.ready()) {
      Serial.println("Waiting for WiFi...");
  Serial.println("Ping end...");

//start udp server

IPAddress myAddr = WiFi.localIP();

    byte first_octet = myAddr[0];
    byte second_octet = myAddr[1];
    byte third_octet = myAddr[2];
    byte fourth_octet = 255;

    broadcastIp = IPAddress(first_octet, second_octet, third_octet, fourth_octet);


loop() {
   //send CRASH HERE!
    Udp.beginPacket(broadcastIp, port);
    Udp.write(msg, sizeInBytes);


If i add this code directly after the Wifi.ready() and i’m connected to the internet it works in manual mode! But without internet connection no way grrr

Serial.println("Connect to cloud");
while(!Particle.connected()) {
  Serial.println("Waiting for cloud connection..");
Serial.println("Disconnect from cloud");

Odd, with this code mine runs just fine.


UDP Udp;
int port = 14400;
IPAddress broadcastIp;
int sizeInBytes = 16;
char msg[256];

void setup()
  IPAddress myAddr = WiFi.localIP();
  broadcastIp = IPAddress(myAddr[0],myAddr[1],myAddr[2],255);


uint32_t ms;
void loop() 
  if (millis() - ms > 100)
    sizeInBytes = sprintf(msg, "It's %d", millis());
    Udp.sendPacket((uint8_t*)msg, sizeInBytes, broadcastIp, port);
    //Udp.beginPacket(broadcastIp, port);
    //Udp.write((uint8_t*)msg, sizeInBytes);
    ms = millis();

I was about to post some of the code that I use to broadcast but it’s basically the same, so no point, but I observe that @ScruffR’s code, and mine, has a time delay before attempting to send another packet. I explicitly coded delay(300) after udp.endpacket(), though cannot remember why I did that.

1 Like

@timx, @ScruffR, it would seem to me that without a delay, you pretty well guarantee a flood of the send buffer. Since there is no error code return on Udp.endPacket(), there is nothing to indicate a buffer overrun. With the Core, a buffer overrun on the CC3000 is guaranteed to cause problems.


And exactly this might be the reason why AUTOMATIC works and SEMI_AUTOMATIC not.
AUTOMATIC (or cloud connection in SEMI_AUTOMATIC) add an aprox. 1ms delay between two iterations of loop() and hence you’ll not overflow the TX buffer.
At least when you are sending small packets, with bigger packets (1K+) you might even find that AUTOMATIC also crashes.


thanks for the reply…strange your code works flawless. i think i have to digg a little bit deeper in mine^^

Getting weird. The delay fixed one issue but not everything:

This works, but the UDP reception returns weird things. have to check this again:

Udp.sendPacket(b, sizeInBytes, broadcastIp, port);

This doesn work, core crashes (doesnt matter if i put delays in between):

Udp.beginPacket(broadcastIp, port);
Udp.write(b, sizeInBytes);

Transfer works with version 1 (dont know why v2 crashes the core), but the reception delivers the correct message length but buffer is filled up with zeros when in semi_auto or manual mode:

 * Return 1 if package was available, otherwise 0
int readUpdPackage() {
    int rcvd = Udp.parsePacket();
    if (rcvd > 0) {
        // Read data, rcvd);

        decodeIncomingUdpPackage((unsigned char*)buffer, rcvd);

        //more bytes received
        if (rcvd > MAX_SIZE) {
            Serial.println("Too large packet");
            while (Udp.available())
        return 1;
    return 0;

Hi @Silence66

How big is sizeInBytes? Larger than one ethernet packet worth?

Hi bko,

between 24 and 350bytes