summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2023-05-18 13:33:06 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2023-05-18 13:33:06 +0200
commita574c239214a963bec1a2229c077af261130277c (patch)
tree9ad620af11d28bbb7f4a97c58c5f88a84f15e42f
parentcb1cc5e64c0db865de76de2e34f1bcb5f90a2dfd (diff)
downloadlora-aprs-hb9egm-a574c239214a963bec1a2229c077af261130277c.tar.gz
lora-aprs-hb9egm-a574c239214a963bec1a2229c077af261130277c.tar.bz2
lora-aprs-hb9egm-a574c239214a963bec1a2229c077af261130277c.zip
Add SD card
-rw-r--r--README.md17
-rw-r--r--platformio.ini1
-rw-r--r--src/main.ino13
3 files changed, 30 insertions, 1 deletions
diff --git a/README.md b/README.md
index cc43f96..a086256 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,26 @@
NUCLEO-H743ZI APRS-LoRa Tracker
===============================
-Connect u-blox NEO-M8N (or other u-blox receiver) to USART-B (RX PD5 and TX PD6) and RFM96 to SPI A and
+Connect u-blox NEO-M8N (or other u-blox receiver) to USART-B (RX PD5 and TX PD6) and RFM96 to SPI A.
See src/main.ino for definitions.
+Pinout
+------
+- u-blox NEO module connected to PD5 and PD6
+- RFM96 connected to SPI A:
+ - MISO (Arduino 12), MOSI (Arduino 11), SCK (Arduino 13)
+ - NSS pin: PD14 (Arduino 10)
+ - DIO0 pin: PF3 (Arduino 8)
+ - RESET pin: PF15 (Arduino 9)
+
+- SD Card connected to SPI B:
+ - MISO (Arduino 25), MOSI (Arduino 22), SCK (Arduino 23)
+ - CS (Arduino 17)
+
+Build
+-----
This project requires: https://platform.io
diff --git a/platformio.ini b/platformio.ini
index c9f1023..a622f22 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -15,3 +15,4 @@ framework = arduino
lib_deps =
jgromes/RadioLib@^6.0.0
sparkfun/SparkFun u-blox GNSS Arduino Library@^2.2.22
+ arduino-libraries/SD@^1.2.4
diff --git a/src/main.ino b/src/main.ino
index 4bcca3e..da82e01 100644
--- a/src/main.ino
+++ b/src/main.ino
@@ -2,6 +2,11 @@
#include <RadioLib.h>
#include <Wire.h>
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
+#include <SD.h>
+
+File myFile;
+
+constexpr int SD_CS = 17;
// SX1278 has the following connections:
// NSS pin: PD14 (Arduino 10)
@@ -49,6 +54,14 @@ void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
+ pinMode(SD_CS, OUTPUT);
+
+ if (!SD.begin(SD_CS)) {
+ Serial.println("SD init failed!");
+ return;
+ }
+
+
Wire.begin();
SerialGNSS.begin(9600);