Has anybody successfully gotten the flash to work on this board? On my other boards (Adafruit Grand Central M4, Sparkfun Thing +) I use the Adafruit SPIflash library with no problem. For some reason no matter what I do on the MicroMod I always get “Unknown flash device: 0x0”. I’ve tried SPI, QSPI, made sure the pins are set up correctly, and that the flash chip is in the flash_devices.h file. I’ve also tried SPI1.begin() with no change. There’s gotta be some dumb thing I’m missing.
It’s not accessible for use.
Are you using a library that uses SoftwareSerial? Because that’s not available on the SAMD51, just regular serial…my guess is you just need to re-write those portions of the code to use the regular version
Wow, nowhere in the product description does it say that you can’t use the flash memory that it explicitly lists as “external flash” like other boards that DO let you use it. Thanks for linking that other thread. So dumb and frustrating.
When comparing schematics of “MicroMod SAMD51 Processor Board” and “SAM D5x/E5x Family Data Sheet”, it seems that MicroMod does not support SAMD51 QUAD SPI, because all QUAD SPI pins of SAMD51 are not connected to FLASH. Unfortunately MicroMod does not support normal SPI either, because for example DI pin of FLASH (= SPI MOSI) is connected to SAMD51 pin PA10. PA10 is PAD2 in both possible SERCOM options of PA10 (SERCOM0 and SERCOM2). PAD2 can not be given MOSI role.
I believe that only option to use external W25Q128JV FLASH memory on MicroMod is bitbanging, which do not sound as a good option.
Good find on the swapped MISO/MOSI pins, I should have noticed that. I have successfully communicated with the flash chip now, using bit bang techniques. It’s fairly quick since I use port mapping and not digitalWrite.
I’m working on a library specifically for the MicroMod now so people can actually use the flash memory.
Here is a library I’m working on for current owners of a v1.2 SAMD51 MicroMod. Its based on the Adafruit SPIFlash library, but uses bit-banging with swapped MISO/MOSI lines in software. Its been tested and works very reliably.
Not all equivalent functions of SPIFlash have made it yet, but I’m working on it. Transfer clock speed seems to hover around 1.429MHz.
Version 1.3 of this module is out now. I got one, and I’m just waiting for the updated schematic to get posted so I know what pins are going where.
Bad news: it looks like the 1.3 version of the module doesn’t work any better than the 1.2 version. The new revision does fix one issue, now correctly attaching the correct pin for COPI to the DI pin on the flash. Sadly, that’s only half the problem, because the wrong pin is still going to CS on the flash. So it amounts to the same issue: the pins are connected in a fashion that isn’t supported by SERCOM2 on the SAMD51 (and SERCOM 0 is being used for the main SPI interface). So there’s no way to make the external flash work on either revision of the board.
I could be wrong about how the new revision is set up: the latest schematic has not been published. I figured out the pins by toning them out with my multimeter.
Attached are the results of checking the 1.2 and 1.3 version of the module.
I’m bummed about this. It feels like neither of these modules was fully tested.
I made a response to the pinout in this forum post here:
https://forum.sparkfun.com/viewtopic.php?f=182&t=56325
With v13 out, you can use SparkFun’s SPI SerialFlash Library (it’s what I used to test) which is found here:
https://github.com/sparkfun/SparkFun_SP … no_Library
Or you can search for the library in the Arduino library manager.
After having tested the new boards with the SPI fixed, I have a more general question. I seem to get much better speed using software data transfer to/from the flash than I do with SPI. I’m using the Adafruit SPIFlash library for SPI (though I’ve tested others as well), and my own bitbang library which is based on the Adafruit SPI library. Tests were done on the SAMD51 MicroMod v1.3 on an ATP Carrier board.
Here is a test program I was using to try and figure this out. It reads 64 pages of 512 bytes into a 2d array:
#include <SPI.h>
//#define FLASHMODE
#define t_PAGES 64
#define b_BYTES 512
#ifdef FLASHMODE
#include "bitbangflash.h"
BitBangFlash flash;
#else
#include <Adafruit_SPIFlash.h>
Adafruit_FlashTransport_SPI flashTransport(PIN_SPI1_SS, SPI1);
Adafruit_SPIFlash flash(&flashTransport);
#endif
void setup() {
while (!Serial) {};
#ifndef FLASHMODE
pinMode(15, OUTPUT); digitalWrite(15, HIGH); // WP/IO2 pin
pinMode(16, OUTPUT); digitalWrite(16, HIGH); // HOLD/IO3 pin
#endif
SPI1.begin();
flash.begin();
#ifdef FLASHMODE
flash.eraseBlock64(0);
#else
flashTransport.setClockSpeed(32000000, 32000000);
flash.eraseBlock(0);
#endif
int dummyRead[t_PAGES][b_BYTES];
int dummyAddr = 0;
long timeStart = micros();
for (int p = 0; p < t_PAGES; p++)
for (int b = 0; b < b_BYTES; b++)
dummyRead[p][b] = flash.read8(dummyAddr++);
long timeEnd = micros();
float timeFinal = (timeEnd - timeStart) / 1000.00f;
#ifdef FLASHMODE
Serial.print("Bitbang timing: ");
#else
Serial.print("SPI timing: ");
#endif
Serial.print(timeFinal, DEC); Serial.println("ms");
//dummyRead[0][0] = dummyRead[0][1];
}
void loop() {
}
And here are the results. I played around with SPI transfer speeds, and things slow down below 12000000 and above 32000000, but the times between are on average the same. This was the fastest SPI time I obtained:
Port open
10:24:08:514 -> SPI timing: 786.0449829102ms
Port open
10:34:43:203 -> Bitbang timing: 593.9089965820ms
Perhaps there is something I’m missing in setting up the SPI function on the SAMD51, or maybe I’ve just been lucky clocking my data manually that fast and getting good reads.