Author Topic: How to access Moteino FLASH when externally (battery) powered  (Read 5134 times)

mattmunee

  • NewMember
  • *
  • Posts: 11
    • MTRTech Wikia
Re: How to access Moteino FLASH when externally (battery) powered
« Reply #15 on: June 27, 2015, 12:37:39 PM »
Guys,
So...I'm still trying to track down my power consumption issue, and I'm trying to follow your recommendations to put the radio and flash (which doesn't exist) to sleep.  In the process, I'm running into this exact issue.  When I power the Moteino through the FTDI plugged into my PC, it behaves as expected.  However, when I use the same USB cable but disconnect it from my computer and plug it into a wall wart adapter, the sketch hangs at flash.initialize().  The sketch also hangs if I instead use a 3.7V LiPo (measuring 4.2 on the multimeter).  I've connected a 10k pulldown resistor between MISO and ground, as recommended in this and other posts.  I tested using the sketch here:
https://github.com/LowPowerLab/SPIFlash/issues/4
Without the pulldown, readStatus() would occasionally return 255, but the pulldown seemed to more reliably make it return 0.  However, I clearly can't test this with serial output when battery powered.  Thoughts?
Fail fast. Fail often.

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: How to access Moteino FLASH when externally (battery) powered
« Reply #16 on: June 27, 2015, 01:26:55 PM »
If your Moteino doesn't have flash installed then don't use the SPIflash Library or instantiate a flash device.    This advice was given assuming you had a full Moteino configuration, which included flash.

If your FTDI cable is not connected to a PC then I wouldn't use it as the power source to your Moteino - there could be many reasons why this hangs.  However, I am curious to know how you know that your code hangs at flash.initialize() if you don't have a debug port attached (ie, the FTDI cable is plugged into a wall wart).  In any case, if you use a wall wart, just use a direct USB A to wire or DC jack type cable.

See if it your Mote still hangs if you remove the flash code and power with wall wart and/or battery and let us know.  Also, as I mentioned in this thread, simply connecting DTR to ground (the two outer pins on the FTDI connector - WITHOUT the FTDI cable installed, of course) sometimes resolves some power on issues.

Tom

mattmunee

  • NewMember
  • *
  • Posts: 11
    • MTRTech Wikia
Re: How to access Moteino FLASH when externally (battery) powered
« Reply #17 on: June 27, 2015, 01:36:30 PM »
Thanks, Tom.  My typical debug-without-serial technique is to use LED flashing.  I put a few LED flashes directly the flash.initialize, which never flash when using a battery/wall wart.  When I comment out the flash lines, everything works fine, regardless of the power source.  Odd behavior.  I don't understand why powering off the FTDI using a wall wart would be an issue.  Looking at the Moteino schematic, the FTDI VIN is connected directly to the VIN pin, so why would that make any difference?  Besides the weird flash behavior, everything else works fine. 

As a side note, today everything works fine in terms of power consumption (kind of).  I've finally reached ~25uA when asleep!  I'll post more about that in the other forum. 
Fail fast. Fail often.

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: How to access Moteino FLASH when externally (battery) powered
« Reply #18 on: June 27, 2015, 03:27:30 PM »
<snip> I don't understand why powering off the FTDI using a wall wart would be an issue.  Looking at the Moteino schematic, the FTDI VIN is connected directly to the VIN pin, so why would that make any difference?  Besides the weird flash behavior, everything else works fine.
The FTDI chip is still driving the RX & DTR pins when powered but not initialized via USB.  FTDI doesn't document this condition so I have no idea what the pins are doing in this state.  Best to leave them disconnected altogether.

Tom