Asset shield: Flashing issues?


#1

Havent used it in a while, but i’m having issues.

Connecting via USB. Did paricle list. Said credentials expired, so re-logged in, using particle login.
Next, downloaded following code as bin:

Servo myServoName;
int pos = 0;

void setup() {
    myServoName.attach( A5 );
    Spark.function("setpos", setPosition);
    Spark.variable("getpos", &pos, INT);
}

void loop() {
    /*
    myServoName.write(0);
    delay(1000);
    myServoName.write(180);
    delay(1000);
    */
}

int setPosition(String posValue) {
    pos = posValue.toInt();
    myServoName.write(pos);
    return 0;
}

Now, I do particle flash --serial servo.bin and it says it’s a success:

! PROTIP: Hold the SETUP button on your device until it blinks blue!
? Press ENTER when your device is blinking BLUE
sending file: servo.bin

Flash success!

  • I hold the button till it flashes blue, then if flashes some colors and gives the success message.

However! Even though I do this 100 times, the code has not been flashed. Why do I say this? Well, in the devices, it lists the functions of the old code I had!
See a screenshot:

If you look at the code, there’s supposed to be 2 functions, setpos and getpos.

On top of that, the main led blinks green, but the led closed to the USB cable is blinking red all the time, and I dont know what that means.

Help?


#2

You are compiling with the Web IDE or CLI?


#3

Can you try particle flash --usb servo.bin in DFU Mode instead?
The success message of --serial is often misleading and --usb is more elaborate.

The red LED on the Asset Tracker Shield is the GPS fix indicator. On the v1 shield this LED would stop flashing once a GPS fix has been acquired.


#4

Compiling with Web IDE.


#5

This is the output.

Device manager still lists the old functions / variables.

particle flash --usb servo.bin 
Found DFU device 2b04:d00a
spawning dfu-util -d 2b04:d00a -a 0 -i 0 -s 0x08080000:leave -D servo.bin
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 2b04:d00a
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x08080000, size = 6876
Download	[=========================] 100%         6876 bytes
Download done.
File downloaded successfully

Flash success!

#6

Also, it’s unable to flash over OTA, but I got billed for this month even though I cant flash it over OTA.


#7

Are you using an electron?


#8

No, it’s an asset shield.


#9

An asset tracker shield (normally) has an electron in it, which is what’s being flashed. That’s also the only device you could be billed for.


#10

Yes, that would be correct. I am being billed for the electron. My question is why, since it wont flash the device over OTA, hence it’s not incurring any charges?

Also, I have a very expensive shield which I cannot flash, so any assistance is welcome.


#11

Update 1: I realized I dont have my antenna on. I cant find it. Is the shield able to use 3G networks without the antenna?


#12

Update 2: I found an NFC antenna with the same socket, and plugged it in. After I did that, the servo started turning.

So questions now:

  • Why wasnt it able to flash the device without the 3G network when I flashed it via USB?

#13

I think it did flash, but the program never was able to run as in default AUTOMATIC mode, the device needs to connect to the cloud in order to start running your firmware
no antenna -> no connectino to cloud -> no running of new code - even with the new firmware on the device.
And since the device could never inform the cloud about the change in Particle.function()/Particle.variable() state, the cloud only knew about the state set by the previous firmware.

You may need to look into SYSTEM_MODE() and/or SYSTEM_THREAD() enabled to overcome this requirement.

BTW, your code in the OP does still use the deprecated syntax

    Spark.function("setpos", setPosition);
    Spark.variable("getpos", &pos, INT);

would now be

    Particle.function("setpos", setPosition);
    Particle.variable("getpos", pos);

#14

Nice, i just looked at the SYSTEM_MODE(), looks interesting.

Btw, since i’m a big idiot that looses antennas, can I just purchase the antenna?


#15

You should be able to order that online

The Electron BOM lists this as the type

Antenna - Penta band 850/900/1800/1900/2100 MHz | IPEX MHFI (U.FL) | Taoglas	PC104.07.0165C

#16

On your store I can only see the WiFi one for order not the 2G one. Any ideas on the socket type or something so I can search elsewhere?


#17

Ok, find it, it’s called an IPEX antenna / connector.


#18

I don’t think Particle sells them seperatly, but you can find them at Mouser or DigiKey or lots of other places.
Just search for Taoglas PC104.07.0165C