0

Log to HUZZAH32 SPI Flash using SPI Flash Library
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Log to HUZZAH32 SPI Flash using SPI Flash Library

by dsprogis on Sat Feb 02, 2019 6:36 pm

Hi Adafruit,

I would like to use the SPI Flash memory of the HUZZAH32 to buffer log events until they are fetched. I assumed the AdaFruit_SPIFlash library would service this capability. After chasing a bunch of warnings and error in the library, I can't seem to get it to work.

Is this a lost cause or is the SPI memory available for use?

Thanks,
Dave

dsprogis
 
Posts: 18
Joined: Wed Jul 13, 2016 3:39 pm

Re: Log to HUZZAH32 SPI Flash using SPI Flash Library

by dsprogis on Sat Feb 02, 2019 7:27 pm

I found SPIFFS and was able to write and read files to the HUZZAH32 Flash Storage.
All set, thanks!

dsprogis
 
Posts: 18
Joined: Wed Jul 13, 2016 3:39 pm

Re: Log to HUZZAH32 SPI Flash using SPI Flash Library

by radhey04ec on Sat Aug 03, 2019 12:55 am

dsprogis wrote:I found SPIFFS and was able to write and read files to the HUZZAH32 Flash Storage.
All set, thanks!


adafruit_support_carter wrote:For (2) - yes, see here:
https://learn.adafruit.com/adafruit-huz ... er/pinouts
Also see pin labels on bottom of board:
https://cdn-learn.adafruit.com/assets/a ... 1494445728



I am using FEATHER 32 Board for developing my project Energy meter. I am using SPI interface for communicating with IC.
I have checked following code with Arduino Uno, with Arduino IDE and it works properly.

I have also checked same code with ESP8266 NODEMCU with some changes and it works.

But I want to access live data using Bluetooth, that's why I have used ESP32 Feather board.

But since last 7 days I cant communicate successfully using SPI.

here is my code:

#include <SPI.h>
#define REG_RUN 0x0480
#define ADE9153A_RUN_ON 0x0001
static const int spiClk = 1000000; // 1 MHz
#define REG_VERSION_PRODUCT 0x0242
#define SPI_SCK 5
//uninitalised pointers to SPI objects
#define CS_PIN 2 //8-->Arduino Zero. 15-->ESP8266 Atuall is 16
#define ADE9153A_RESET_PIN 15 //On-board Reset Pin (4)
unsigned int data16;

void setup() {
//initialise two instances of the SPIClass attached to VSPI and HSPI respectively
Serial.begin(115200);
pinMode(ADE9153A_RESET_PIN, OUTPUT);
digitalWrite(ADE9153A_RESET_PIN, HIGH);
digitalWrite(ADE9153A_RESET_PIN, LOW);
delay(100);
digitalWrite(ADE9153A_RESET_PIN, HIGH);
delay(1000);
Serial.println("Reset Done");
//clock miso mosi ss
pinMode(CS_PIN, OUTPUT); // Added this line externally for ESP8266
digitalWrite(CS_PIN, HIGH);
delay(100);
digitalWrite(CS_PIN,LOW);
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0)); //set parameters
SPI.begin(); // init SPI
delay(10);
uint16_t temp_address,Address;
Address = REG_RUN;
digitalWrite(CS_PIN, LOW);
temp_address = ((Address << 4) & 0xFFF0); //shift address to align with cmd packet
SPI.transfer16(temp_address);
SPI.transfer16(ADE9153A_RUN_ON);
Serial.println("DSP ON");
Serial.println(temp_address,HEX);
Serial.println(ADE9153A_RUN_ON,HEX);


digitalWrite(CS_PIN, HIGH);

delay(1000);

Serial.println(MISO);
Serial.println(MOSI);
Serial.println(SCK);
uint16_t temp_address1,Address1;
uint32_t temp_highpacket;
uint16_t temp_lowpacket;
uint32_t returnData;
Address1 = REG_VERSION_PRODUCT;
digitalWrite(CS_PIN, LOW);
temp_address1 = (((Address1 << 4) & 0xFFF0)+8);
SPI.transfer16(temp_address1);
Serial.println(temp_address1,HEX);
temp_highpacket = SPI.transfer16(0x0000);
temp_lowpacket = SPI.transfer16(0x0000);

digitalWrite(CS_PIN, HIGH);
SPI.endTransaction();

returnData = temp_highpacket << 16;
returnData = returnData + temp_lowpacket;
if (returnData != 0x0009153A)
{
Serial.println("Wrong");
Serial.println(temp_highpacket,HEX);
Serial.println(temp_lowpacket,HEX);
//Serial.printf(returnData,HEX);
}
Serial.println("done");

}
void loop() {

delay(100);
}


Can you provide any reference or example : how two connect two feather board using SPI with code and connection diagaram ? in arduino IDE ?

if you will provide simple example of two ESP 32 SPI communication than its very helpfull for me

Looking for your support.

radhey04ec
 
Posts: 7
Joined: Sat Aug 03, 2019 12:41 am

Please be positive and constructive with your questions and comments.