Electron Won't Enter Manual Mode

Hello!

I can’t get my Electron dev kit to go into manual mode. The device just sits with the green LED blinking. No communication to the Serial port.

From the docs, I tried both SYSTEM_MODE(MANUAL) and Cellular.off() though it seems like the second is deprecated. I’m working with VS Code on OSX. Flashing via USB with the Particle CLI.

Dev kit does NOT have the battery or antenna connected.

Code below…

SYSTEM_MODE(MANUAL);    // setting this so that the device can run without the cell network 

/*
SS => A2 (default)
SCK => A3
MISO => A4
MOSI => A5
*/

volatile uint8_t tx_buffer[8]; 
volatile uint8_t rx_buffer[8];
volatile uint8_t slave_selected = false; 
volatile uint8_t transfer_complete = false;

static byte data_to_master = 0xFF;

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("Initialzed");
  SPI.begin(SPI_MODE_SLAVE, A2); 
}

void loop() {
  // if the slave is selected and SPI is available 
  int32_t num_incoming = SPI.available();
  Serial.println(num_incoming);
  while (num_incoming > 0) {
    num_incoming--; 
    Serial.print("Received ");
    byte data_in = SPI.transfer(data_to_master);
    Serial.println(data_in);   
  }
  Serial.println("Looping..");
}

Any help appreciated!

What device OS version are you running?
You shouldn’t really check SPI.available() unwarranted.
I’m not convinced it’s an issue with SYSTEM_MODE(MANUAL) but suspect your SPI code to interfere.

Try running using SPI slave mode as documented here
https://docs.particle.io/reference/device-os/firmware/electron/#onselect-

However, when I tried your code, my Electron did breathe white - as expected.
Maybe your device isn’t actually running your code.

Running the latest 1.0.1

Why shouldn’t I be checking SPI.available()? According to the docs, if the receive buffer is empty, it returns 0, so I don’t see a problem with this. Shouldn’t need to run a handler method, and the docs indicate that you should be able to run in the fashion above through the DMA, without halting the entire program.

To clarify, this is not a problem with SPI, as this code yields the same result;

SYSTEM_MODE(MANUAL);    // setting this so that the device can run without the cell network 

/*
SS => A2 (default)
SCK => A3
MISO => A4
MOSI => A5
*/

volatile uint8_t tx_buffer[8]; 
volatile uint8_t rx_buffer[8];
volatile uint8_t slave_selected = false; 
volatile uint8_t transfer_complete = false;

static byte data_to_master = 0xFF;

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("Initialzed");
  // SPI.begin(SPI_MODE_SLAVE, A2); 
}

void loop() {
  // if the slave is selected and SPI is available 
  /* 
  int32_t num_incoming = SPI.available();
  Serial.println(num_incoming);
  while (num_incoming > 0) {
    num_incoming--; 
    Serial.print("Received ");
    byte data_in = SPI.transfer(data_to_master);
    Serial.println(data_in);   
  }
  */
  delay(100);
  Serial.println("Looping..");
}

My hunch is that there is a startup process that can’t be subverted that checks in with the ublox module and isn’t happy because I’m missing the antenna.

@ScruffR when you flashed this to your Electron, was it configured like mine, without the antenna or battery?

Nope, but I can try.


Just tried it and it still works as expected.

But, how did you flash without antenna and battery?

@ScruffR I flashed it using the CLI via USB, which is also powering it.

Sounds like you’re using the web IDE, flashing via LTE and then disconnecting the antenna and battery?

Either way, the behavior shouldn’t be different, unless of course your configuration is letting the ublox module boot and report status to the STM32 before disconnecting the antenna and battery.

If it is in fact the case that there is a boot dependency between the STM32 and the ublox LTE module, then the documentation about manual mode is somewhat incorrect/misleading as the wording makes it seem as though this would let someone use the device without any network dependencies. Trying to verify this is the case, as it would render the device far less usable for my application (which can’t have a Lipo or guaranteed cell/antenna connection)

Thanks for your help.

I just put your code on my Electron without an antenna or battery. It stays blinking white and spams the usb serial port with the following.

0
Looping..

If you are flashing locally, you may have loaded an app firmware that depends on a newer version of Device-OS and inadvertently put your device into safe-mode. This will bypass your user application and try and connect to the cloud.

If using Workbench, select Particle: Flash Application and Device OS (local) to make sure you are flashing the Device-OS dependency as well.

1 Like

@joel I have been running the following in the CLI

bash-3.2$ particle compile electron --saveTo output.bin
bash-3.2$ particle flash --usb output.bin

With the device in dfu mode, which worked fine when the device was networked, doesn’t seem to be working since removing the antenna.

Per your sugguestion, I first ran Particle: Compile Application & DeviceOS (local) which yields

> Executing task in folder Particle_SPI_test: make -f '/Users/**********/.particle/toolchains/buildscripts/1.5.1/Makefile' compile-all -s <

   /Users/**********/.particle/toolchains/deviceOS/1.3.0-rc.1/firmware-1.3.0-rc.1/modules/electron/system-part1/makefile /Users/**********/.particle/toolchains/deviceOS/1.3.0-rc.1/firmware-1.3.0-rc.1/modules/electron/system-part2/makefile /Users/**********/.particle/toolchains/deviceOS/1.3.0-rc.1/firmware-1.3.0-rc.1/modules/electron/system-part3/makefile /Users/**********/.particle/toolchains/deviceOS/1.3.0-rc.1/firmware-1.3.0-rc.1/modules/electron/user-part/makefile
   text    data     bss     dec     hex filename
  75748     556    2624   78928   13450 ../../../build/target/system-part1/platform-10-m/system-part1.elf
   text    data     bss     dec     hex filename
 125080     212     564  125856   1eba0 ../../../build/target/system-part2/platform-10-m/system-part2.elf
   text    data     bss     dec     hex filename
 120668    2692    4424  127784   1f328 ../../../build/target/system-part3/platform-10-m/system-part3.elf
   text    data     bss     dec     hex filename
   4604     108     452    5164    142c /Users/**********/Documents/modules/Particle_SPI_test/target/Particle_SPI_test.elf

*** COMPILED SUCCESSFULLY ***


Press any key to close the terminal.

After which I ran Particle: Flash Application & DeviceOS (local) which produced

> Executing task in folder Particle_SPI_test: make -f '/Users/*******/.particle/toolchains/buildscripts/1.5.1/Makefile' flash-all -s <

   /Users/*******/.particle/toolchains/deviceOS/1.3.0-rc.1/firmware-1.3.0-rc.1/modules/electron/system-part1/makefile /Users/*******/.particle/toolchains/deviceOS/1.3.0-rc.1/firmware-1.3.0-rc.1/modules/electron/system-part2/makefile /Users/*******/.particle/toolchains/deviceOS/1.3.0-rc.1/firmware-1.3.0-rc.1/modules/electron/system-part3/makefile /Users/*******/.particle/toolchains/deviceOS/1.3.0-rc.1/firmware-1.3.0-rc.1/modules/electron/user-part/makefile
   text    data     bss     dec     hex filename
  75748     556    2624   78928   13450 ../../../build/target/system-part1/platform-10-m/system-part1.elf
Serial device PARTICLE_SERIAL_DEV : not available
Flashing using dfu:
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/

Deducing device DFU version from functional descriptor length
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 = 0x08060000, size = 76304
Download        [=========================] 100%        76304 bytes
Download done.
File downloaded successfully
   text    data     bss     dec     hex filename
 125080     212     564  125856   1eba0 ../../../build/target/system-part2/platform-10-m/system-part2.elf
Serial device PARTICLE_SERIAL_DEV : not available
Flashing using dfu:
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/

Deducing device DFU version from functional descriptor length
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 = 0x08020000, size = 125296
Download        [=========================] 100%       125296 bytes
Download done.
File downloaded successfully
   text    data     bss     dec     hex filename
 120668    2692    4424  127784   1f328 ../../../build/target/system-part3/platform-10-m/system-part3.elf
Serial device PARTICLE_SERIAL_DEV : not available
Flashing using dfu:
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/

Deducing device DFU version from functional descriptor length
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 = 0x08040000, size = 123360
Download        [=========================] 100%       123360 bytes
Download done.
File downloaded successfully
   text    data     bss     dec     hex filename
   4604     108     452    5164    142c /Users/*******/Documents/modules/Particle_SPI_test/target/Particle_SPI_test.elf
Serial device PARTICLE_SERIAL_DEV : not available
Flashing using dfu:
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/

Deducing device DFU version from functional descriptor length
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 = 4712
Download        [=========================] 100%         4712 bytes
Download done.
File downloaded successfully

*** FLASHED SUCCESSFULLY ***


Press any key to close the terminal.

Producing the same result, a blinking green LED, with no connectivity. At a loss for what I’m doing wrong.

For anyone facing the same issue, Joel’s solution seemed to do it. Once I re-connected to the network, I was able to fix the Device OS version and now we’re up and running with the command line!