Author Topic: Listening at 433 Mhz... SPI Flash Init FAIL! (is chip present?) [SOLVED]  (Read 8505 times)

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
I'm sure it is something stupid that I am doing but....

Got a couple of shiny new Megas today and tried to throw PiGateway on them and I am getting the following error:

Code: [Select]
SPI Flash Init FAIL! (is chip present?)

And I think it is because I do not have this correct:

Code: [Select]
#define FLASH_CS        8
SPIFlash flash(FLASH_CS, 0xEF40); //EF40 for 16mbit windbond chip

Can someone point me to the right settings for the Mega?


Thanks
« Last Edit: May 12, 2016, 04:52:36 PM by Felix »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Listening at 433 Mhz... SPI Flash Init FAIL! (is chip present?)
« Reply #1 on: May 12, 2016, 10:55:03 AM »
Should be 0xEF30 if it's an OEM Moteino+FLASHMEM.

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Listening at 433 Mhz... SPI Flash Init FAIL! (is chip present?)
« Reply #2 on: May 12, 2016, 12:02:35 PM »
Should be 0xEF30 if it's an OEM Moteino+FLASHMEM.
Wow, I cut and pasted this directly from Node.ino in the RFM69 library.  Admittedly it's an older version of the library, however...

Tom

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Listening at 433 Mhz... SPI Flash Init FAIL! (is chip present?)
« Reply #3 on: May 12, 2016, 12:38:18 PM »
Exact same result on both of the MegaUSBs that I purchased.

Code: [Select]
SPI Flash Init FAIL! (is chip present?)


With this:
Code: [Select]
#define FLASH_CS        8
SPIFlash flash(FLASH_CS, 0xEF30); //EF40 for 16mbit windbond chip

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Listening at 433 Mhz... SPI Flash Init FAIL! (is chip present?)
« Reply #4 on: May 12, 2016, 02:39:56 PM »
Make sure the CS is correctly set. It is D8 only on Moteinos. On MoteinoMEGAs they are D23:

Code: [Select]
#ifdef __AVR_ATmega1284P__
  #define LED           15 // Moteino MEGAs have LEDs on D15
  #define FLASH_SS      23 // and FLASH SS on D23
#else
  #define LED           9 // Moteinos have LEDs on D9
  #define FLASH_SS      8 // and FLASH SS on D8
#endif

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Listening at 433 Mhz... SPI Flash Init FAIL! (is chip present?)
« Reply #5 on: May 12, 2016, 04:37:03 PM »
That did the trick Felix!

pedro.albuquerque

  • NewMember
  • *
  • Posts: 19
  • Country: pt
I'm having similar problem, certainly some thing basic , nevertheless not able to find what.

I tried to load the SPIFlash_ReadWrite example sketch to a Motion MEGA LORA with SPI Flash

"
#ifdef __AVR_ATmega1284P__
#define LED           15 // Moteino MEGAs have LEDs on D15
#define FLASH_SS      23 // and FLASH SS on D23
#else
#define LED           9 // Moteinos have LEDs on D9
#define FLASH_SS      8 // and FLASH SS on D8
#endif

//////////////////////////////////////////
// flash(SPI_CS, MANUFACTURER_ID)
// SPI_CS          - CS pin attached to SPI flash chip (8 in case of Moteino)
// MANUFACTURER_ID - OPTIONAL, 0x1F44 for adesto(ex atmel) 4mbit flash
//                             0xEF30 for windbond 4mbit flash
//////////////////////////////////////////
SPIFlash flash(FLASH_SS, 0xEF30);

void setup(){
    Serial.begin(SERIAL_BAUD);
    Serial.print("Start...");
   
    if (flash.initialize())
"

But i get an error "Start...Init FAIL!" on Terminal

Any clue on this ?



Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
I just tested this sketch and it works just fine.
If the chip is not damaged in some way and all connections look good it should work.

pedro.albuquerque

  • NewMember
  • *
  • Posts: 19
  • Country: pt
Thanks Felix for confirming,

I tried the sketch on a Motion LR and it worked fine, then repeated on a Motion Mega LR and again it fails... I may have a problem with the flash ship on may Mega board.


TomWS

  • Hero Member
  • *****
  • Posts: 1930
Thanks Felix for confirming,

I tried the sketch on a Motion LR and it worked fine, then repeated on a Motion Mega LR and again it fails... I may have a problem with the flash ship on may Mega board.

Add this code in your setup function BEFORE your flash.initialize() call.

Code: [Select]
   word id = flash.readDeviceId();
   Serial.print("Flash ID="); Serial.println(id,HEX);

This will tell you what is being read back (if anything).

Tom

pedro.albuquerque

  • NewMember
  • *
  • Posts: 19
  • Country: pt
Thanks TomWs for your suggestion,

I tested it on Motion and the result was EF30, but on Motion Mega the answer is
"Start...Flash ID=0
Init FAIL!
"

Definitely the Flash has a problem....


TomWS

  • Hero Member
  • *****
  • Posts: 1930
Thanks TomWs for your suggestion,

I tested it on Motion and the result was EF30, but on Motion Mega the answer is
"Start...Flash ID=0
Init FAIL!
"

Definitely the Flash has a problem....
The only other possibility (other than broken HW) is that your Arduino IDE has Board set for Moteino, not Moteino Mega...

Tom

pedro.albuquerque

  • NewMember
  • *
  • Posts: 19
  • Country: pt
Thanks TomWs for your suggestion,

I tested it on Motion and the result was EF30, but on Motion Mega the answer is
"Start...Flash ID=0
Init FAIL!
"

Definitely the Flash has a problem....
The only other possibility (other than broken HW) is that your Arduino IDE has Board set for Moteino, not Moteino Mega...

Tom

I did check that, and even verified that it i using FLASH_SS = 23
"Start...Flash_ss:23
Flash ID=0
Init FAIL!
"

pedro.albuquerque

  • NewMember
  • *
  • Posts: 19
  • Country: pt
Problem Solved  :D :D :D Hurra!

The left pins (all 4) of the chip were left unsoldered, no contact.

No works fine, thank you for your help with confirmation and debugging clues.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Problem Solved  :D :D :D Hurra!

The left pins (all 4) of the chip were left unsoldered, no contact.

No works fine, thank you for your help with confirmation and debugging clues.

Wow, this must have slipped through the cracks in testing.
I've only ever seen this happen when a resistor or other small part was dropped by the P&P under the chip, this happened once that I can remember.
I usually test the boards but it's a visual test that the chip can read back a value, so it's possible i missed it and if the chip was not soldered properly it ended up being a fail. Sorry about that and thanks for the update.