rak4631: gps now works

This commit is contained in:
Kevin Hester 2021-04-11 15:17:56 +08:00
parent f7d199a3be
commit 7224782d23
5 changed files with 67 additions and 10 deletions

View File

@ -19,8 +19,19 @@ Must be installed on the front for the I2C wires to lineup
Solar enclosure
https://docs.rakwireless.com/Product-Categories/Accessories/RAKBox-B2/Overview/#product-description
Base datasheet (for GPIO mapping)
https://docs.rakwireless.com/Product-Categories/WisBlock/RAK5005-O/Datasheet/#specifications
CPU module carrier (rak4631)
https://docs.rakwireless.com/Product-Categories/WisBlock/RAK4631/Datasheet/#specifications
## TODO
> 3V3_S is another 3.3 V power supply, it can be controlled by the MCU in order to disconnect the power sensors during idle periods to save power. 3V3_S is controlled by IO2 pin on the WisBlock Core board.
Set IO2=1, 3V3_S is on.
Set IO2=0, 3V3_S is off.
* DONE solder header
* DONE attach antenna
* get building (LORA disabled)
@ -34,5 +45,11 @@ https://docs.rakwireless.com/Product-Categories/Accessories/RAKBox-B2/Overview/#
* Boot
* Enable LORA but no TX
* Enable LORA TX
* Enable bluetooth
* Relase as standard part of build (including UF2s)
* Make this doc into a nice HOWTO: what to order, how to connect (which device in which slots), how to install software
* Setup battery voltage sensing
* Set bluetooth PIN support
* Confirm low power draw
* send in PR to https://github.com/geeksville/WisBlock for boards define
*

View File

@ -299,6 +299,8 @@ build_flags = ${nrf52_base.build_flags} -Ivariants/WisCore_RAK4631_Board
src_filter = ${nrf52_base.src_filter} +<../variants/eink>
lib_deps =
${arduino_base.lib_deps}
debug_tool = jlink
upload_protocol = jlink
; The PPR board
[env:ppr]

View File

@ -7,7 +7,7 @@
#include <assert.h>
// If we have a serial GPS port it will not be null
#ifdef GPS_RX_PIN
#ifdef GPS_SERIAL_NUM
HardwareSerial _serial_gps_real(GPS_SERIAL_NUM);
HardwareSerial *GPS::_serial_gps = &_serial_gps_real;
#elif defined(NRF52840_XXAA) || defined(NRF52833_XXAA)
@ -34,7 +34,8 @@ bool GPS::setupGPS()
if (_serial_gps && !didSerialInit) {
didSerialInit = true;
#ifdef GPS_RX_PIN
// ESP32 has a special set of parameters vs other arduino ports
#if defined(GPS_RX_PIN) && !defined(NO_ESP32)
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
#else
_serial_gps->begin(GPS_BAUDRATE);
@ -319,8 +320,8 @@ int GPS::prepareDeepSleep(void *unused)
#include "NMEAGPS.h"
#endif
GPS* createGps() {
GPS *createGps()
{
#ifdef NO_GPS
return nullptr;
@ -329,7 +330,7 @@ GPS* createGps() {
#ifdef GPS_TX_PIN
// Init GPS - first try ublox
UBloxGPS *ublox = new UBloxGPS();
if (!ublox->setup()) {
DEBUG_MSG("ERROR: No UBLOX GPS found\n");
delete ublox;
@ -344,9 +345,9 @@ GPS* createGps() {
// assume NMEA at 9600 baud.
DEBUG_MSG("Hoping that NMEA might work\n");
#ifdef HAS_AIR530_GPS
GPS* new_gps = new Air530GPS();
GPS *new_gps = new Air530GPS();
#else
GPS* new_gps = new NMEAGPS();
GPS *new_gps = new NMEAGPS();
#endif
new_gps->setup();
return new_gps;

View File

@ -427,8 +427,11 @@ void setup()
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
#ifdef GENIEBLOCKS
// gps setup
pinMode(GPS_RESET_N, OUTPUT);
I'm intentionally breaking your build so you see this note. Feel free to revert if not correct. I think you can
removed this code by instead defining PIN_GPS_RESET and use the shared code in GPS.cpp instead.
// gps setup
pinMode(GPS_RESET_N, OUTPUT);
pinMode(GPS_EXTINT, OUTPUT);
digitalWrite(GPS_RESET_N, HIGH);
digitalWrite(GPS_EXTINT, LOW);

View File

@ -136,8 +136,42 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define EXTERNAL_FLASH_DEVICES IS25LP080D
#define EXTERNAL_FLASH_USE_QSPI
/* @note RAK5005-O GPIO mapping to RAK4631 GPIO ports
RAK5005-O <-> nRF52840
IO1 <-> P0.17 (Arduino GPIO number 17)
IO2 <-> P1.02 (Arduino GPIO number 34)
IO3 <-> P0.21 (Arduino GPIO number 21)
IO4 <-> P0.04 (Arduino GPIO number 4)
IO5 <-> P0.09 (Arduino GPIO number 9)
IO6 <-> P0.10 (Arduino GPIO number 10)
SW1 <-> P0.01 (Arduino GPIO number 1)
A0 <-> P0.04/AIN2 (Arduino Analog A2
A1 <-> P0.31/AIN7 (Arduino Analog A7
SPI_CS <-> P0.26 (Arduino GPIO number 26)
*/
// RAK4630 LoRa module
#define SX1262_CS (42)
#define SX1262_DIO1 (47)
#define SX1262_BUSY (46)
#define SX1262_RESET (38)
#define SX1262_TXEN (39)
#define SX1262_RXEN (37)
#define SX1262_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
// RAK1910 GPS module
// If using the wisblock GPS module and pluged into Port A on WisBlock base
// IO1 is hooked to PPS (pin 12 on header) = gpio 17
// IO2 is hooked to GPS RESET = gpio 34, but it can not be used to this because IO2 is ALSO used to control 3V3_S power (1 is on).
// Therefore must be 1 to keep peripherals powered
// Power is on the controllable 3V3_S rail
// #define PIN_GPS_RESET (34)
#define PIN_GPS_EN (34)
#define PIN_GPS_PPS (17) // Pulse per second input from the GPS
#define GPS_RX_PIN PIN_SERIAL1_RX
#define GPS_TX_PIN PIN_SERIAL1_TX
// Meshtastic specific flags
#define USE_SIM_RADIO
#define USE_SEGGER
#ifdef __cplusplus