Skip to content
Open
Prev Previous commit
Next Next commit
WIP SD testing.
  • Loading branch information
SFE-Brudnerd committed Feb 8, 2024
commit ff5cd76df9efb9a22d11623daa1c831772528c54
2 changes: 1 addition & 1 deletion libraries/BlockDevices/BlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifdef ARDUINO_PORTENTA_C33
#if defined(ARDUINO_PORTENTA_C33) || defined(ARDUINO_THINGPLUS_RA6M5)

#include <QSPIFlashBlockDevice.h>

Expand Down
26 changes: 26 additions & 0 deletions variants/THINGPLUS_RA6M5/pinmux.inc
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,29 @@ const uint16_t P014[] = {
PIN_ANALOG|CHANNEL_12|ADC_0|LAST_ITEM_GUARD
};

// pins not yet handled by the script
const uint16_t P208[] = { LAST_ITEM_GUARD };

const uint16_t P209[] = { LAST_ITEM_GUARD };

const uint16_t P210[] = {
PIN_PWM_AGT|CHANNEL_5|PWM_CHANNEL_B|LAST_ITEM_GUARD,
};

const uint16_t P211[] = { LAST_ITEM_GUARD };

const uint16_t P214[] = { LAST_ITEM_GUARD };


const uint16_t P015_b[] = {
PIN_DAC|CHANNEL_1,
PIN_ANALOG|CHANNEL_13|ADC_0,
PIN_INTERRUPT|CHANNEL_13|LAST_ITEM_GUARD
};
#define P015 P015_b

const uint16_t P014_b[] = {
PIN_DAC|CHANNEL_0,
PIN_ANALOG|CHANNEL_12|ADC_0|LAST_ITEM_GUARD
};
#define P014 P014_b
43 changes: 26 additions & 17 deletions variants/THINGPLUS_RA6M5/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,27 @@ static const uint8_t PICO = PIN_SPI_MOSI;
/****** SDCARD CORE DEFINES *******/
#define SDCARD_HOWMANY 1


#define EXT_INTERRUPTS_HOWMANY 14

#define USE_4BIT_SDCARD 1

/****** USB CORE DEFINES ******/
#define USB_VID (0x1b4f)
#define USB_PID (0x0036)
#define USB_NAME "SparkFun Thing Plus RA6M5"

/****** FLASH DEFINES ******/
#define ARDUINO_FLASH_TYPE HP_FLASH
#define FLASH_BASE_ADDRESS 0x08000000
#define FLASH_TOTAL_SIZE 0x2000
#define FLASH_BLOCK_SIZE 0x40

#define PIN_QSPI_CLK (40u)
#define PIN_QSPI_SS (41u)
#define PIN_QSPI_D0 (42u)
#define PIN_QSPI_D1 (43u)
#define PIN_QSPI_D2 (44u)
#define PIN_QSPI_D3 (45u)
/****** QSPI CORE DEFINES ******/

#define PIN_QSPI_CLK (40)
#define PIN_QSPI_SS (41)
#define PIN_QSPI_D0 (42)
#define PIN_QSPI_D1 (43)
#define PIN_QSPI_D2 (44)
#define PIN_QSPI_D3 (45)

#define HAS_QSPI

Expand All @@ -154,15 +155,23 @@ static const uint8_t PICO = PIN_SPI_MOSI;
#define QSPI_ERASE_BLOCK_SIZE (0x1000)
#define QSPI_WRITE_BLOCK_SIZE (0x1)

/****** MISC GPIO CORE DEFINES ******/
#define EXT_INTERRUPTS_HOWMANY 14

#define SD_NEN (35)
#define BLE_NRST (36)
#define VREF_EN (37)
#define PWR_STAT (38)

#define HAS_SDHI

#define PIN_SDHI_CLK (22u)
#define PIN_SDHI_CMD (23u)
#define PIN_SDHI_D0 (24u)
#define PIN_SDHI_D1 (25u)
#define PIN_SDHI_D2 (26u)
#define PIN_SDHI_D3 (27u)
#define PIN_SDHI_CD (28u)
#define PIN_SDHI_WP (29u)
#define PIN_SDHI_CLK (22)
#define PIN_SDHI_CMD (23)
#define PIN_SDHI_D0 (24)
#define PIN_SDHI_D1 (25)
#define PIN_SDHI_D2 (26)
#define PIN_SDHI_D3 (27)
#define PIN_SDHI_CD (28)
#define PIN_SDHI_WP (29)

#define RTC_CLOCK_SOURCE RTC_CLOCK_SOURCE_SUBCLK
43 changes: 16 additions & 27 deletions variants/THINGPLUS_RA6M5/variant.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
#include "Arduino.h"
#include "pinmux.inc"

// pins not yet handled by the script
const uint16_t P208[] = { LAST_ITEM_GUARD };

const uint16_t P209[] = { LAST_ITEM_GUARD };

const uint16_t P210[] = {
PIN_PWM_AGT|CHANNEL_5|PWM_CHANNEL_B|LAST_ITEM_GUARD,
};

const uint16_t P211[] = { LAST_ITEM_GUARD };

const uint16_t P214[] = { LAST_ITEM_GUARD };


const uint16_t P015_b[] = {
PIN_DAC|CHANNEL_1,
PIN_ANALOG|CHANNEL_13|ADC_0,
PIN_INTERRUPT|CHANNEL_13|LAST_ITEM_GUARD
};
#define P015 P015_b

const uint16_t P014_b[] = {
PIN_DAC|CHANNEL_0,
PIN_ANALOG|CHANNEL_12|ADC_0|LAST_ITEM_GUARD
};
#define P014 P014_b

extern "C" const PinMuxCfg_t g_pin_cfg[] = {

// Thing Plus Form Factor
Expand Down Expand Up @@ -126,6 +99,22 @@ void initVariant() {
// bootloader configures LED_BUILTIN as PWM output, deconfigure it to avoid spurious signals
pinMode(LED_BUILTIN, INPUT);

// Set internal gpio pins.
// Disable SD Card Power
pinMode(SD_NEN, OUTPUT_OPENDRAIN);
digitalWrite(SD_NEN, HIGH);

// Turn on VREF.
pinMode(VREF_EN, OUTPUT_OPENDRAIN);
digitalWrite(VREF_EN, HIGH);

// Configure Battery Power Mode Status Pin
pinMode(PWR_STAT, INPUT_PULLUP);

// Take BLE out of reset.
pinMode(BLE_NRST, OUTPUT_OPENDRAIN);
digitalWrite(BLE_NRST, HIGH);

// We're using an extenal reference voltage, so set that here. NOTE: AREF = 3.3V
analogReference(AR_EXTERNAL);
}