Skip to content

SNU - Second Stage Bootloader for WiFi NINA enabled boards #512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 1, 2020
Merged
Prev Previous commit
Next Next commit
Adding support for Arduino Vidor 4000
  • Loading branch information
aentinger committed Jun 24, 2020
commit b2824aef857ce9e6a4ee9954a20bc3b3cfe178db
28 changes: 22 additions & 6 deletions libraries/SNU/extras/NiNaBoot/NiNaBoot.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
#include <WiFiNINA.h>
#include <FlashStorage.h>

#ifdef ARDUINO_SAMD_MKRVIDOR4000
#include <VidorPeripherals.h>
#endif /* ARDUINO_SAMD_MKRVIDOR4000 */

#ifdef ARDUINO_SAMD_MKRVIDOR4000
#define NINA_GPIO0 FPGA_NINA_GPIO0
#define NINA_RESETN FPGA_SPIWIFI_RESET
#endif /* ARDUINO_SAMD_MKRVIDOR4000 */

#define SDU_START 0x2000
#define SDU_SIZE 0x4000

Expand All @@ -38,13 +47,20 @@ int main() {

delay(1);

// NINA - SPI boot
pinMode(NINA_GPIO0, OUTPUT);
digitalWrite(NINA_GPIO0, HIGH);

// disable NINA
pinMode(NINA_RESETN, OUTPUT);
#if defined(ARDUINO_SAMD_MKRVIDOR4000)
FPGA.begin();
/* NINA select SPI mode and enable (by setting RESETN = '1') */
FPGA.pinMode (NINA_GPIO0, OUTPUT);
FPGA.digitalWrite(NINA_GPIO0, HIGH);
FPGA.pinMode (NINA_RESETN, OUTPUT);
FPGA.digitalWrite(NINA_RESETN, HIGH);
#elif defined(ARDUINO_SAMD_MKRWIFI1010)
/* NINA select SPI mode and enable (by setting RESETN = '1') */
pinMode (NINA_GPIO0, OUTPUT);
digitalWrite(NINA_GPIO0, HIGH);
pinMode (NINA_RESETN, OUTPUT);
digitalWrite(NINA_RESETN, HIGH);
#endif

if (WiFi.status() == WL_NO_SHIELD) {
goto boot;
Expand Down