Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.

Dependencies:   MaximTinyTester MAX11410 CmdLine USBDevice

Files at this revision

API Documentation at this revision

Comitter:
whismanoid
Date:
Tue Oct 27 01:04:03 2020 +0000
Parent:
75:30f92fc5862d
Commit message:
improve response time Measure_Voltage (for MAX11410 EMC testing)

Changed in this revision

MAX11410.lib Show annotated file Show diff for this revision Revisions of this file
MaximTinyTester.lib Show annotated file Show diff for this revision Revisions of this file
Test_Main_MAX11410.cpp Show annotated file Show diff for this revision Revisions of this file
Test_Menu_MAX11410.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MAX11410.lib	Fri Jun 05 00:33:19 2020 +0000
+++ b/MAX11410.lib	Tue Oct 27 01:04:03 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/MaximIntegrated/code/MAX11410/#1b72865fa71f
+https://os.mbed.com/teams/MaximIntegrated/code/MAX11410/#f94470c95dde
--- a/MaximTinyTester.lib	Fri Jun 05 00:33:19 2020 +0000
+++ b/MaximTinyTester.lib	Tue Oct 27 01:04:03 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/whismanoid/code/MaximTinyTester/#c294236d7465
+https://os.mbed.com/users/whismanoid/code/MaximTinyTester/#ac3e4930df8b
--- a/Test_Main_MAX11410.cpp	Fri Jun 05 00:33:19 2020 +0000
+++ b/Test_Main_MAX11410.cpp	Tue Oct 27 01:04:03 2020 +0000
@@ -64,9 +64,20 @@
 //      - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/
 //      - not tested yet
 //   - MAX32625PICO
+//      - #include "max32625pico.h"
+//      - add https://os.mbed.com/users/switches/code/max32625pico/
 //      - remove max32630fthr library (if present)
 //      - remove MAX32620FTHR library (if present)
 //      - not tested yet
+//      - see https://os.mbed.com/users/switches/code/max32625pico/
+//      - see https://os.mbed.com/users/switches/code/PICO_board_demo/
+//      - see https://os.mbed.com/users/switches/code/PICO_USB_I2C_SPI/
+//      - see https://os.mbed.com/users/switches/code/SerialInterface/
+//      - Note: To load the MAX32625PICO firmware, hold the button while
+//        connecting the USB cable, then copy firmware bin file 
+//        to the MAINTENANCE drive.
+//      - see https://os.mbed.com/platforms/MAX32625PICO/
+//      - see https://os.mbed.com/teams/MaximIntegrated/wiki/MAX32625PICO-Firmware-Updates
 //
 // end Platform_Include_Boilerplate
 #include "MAX11410.h"
@@ -79,6 +90,9 @@
 #if defined(TARGET_MAX32625MBED)
 #include "USBSerial.h"
 USBSerial serial; // virtual serial port over USB (DEV connector)
+#elif defined(TARGET_MAX32625PICO)
+#include "USBSerial.h"
+USBSerial serial; // virtual serial port over USB (DEV connector)
 #elif defined(TARGET_MAX32600MBED)
 #include "USBSerial.h"
 USBSerial serial; // virtual serial port over USB (DEV connector)
@@ -374,6 +388,25 @@
 //--------------------------------------------------
 #elif defined(TARGET_MAX32625PICO)
 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
+#include "max32625pico.h"
+// configure MAX32625PICO VDDIOH mode, and I/O voltages for DIP pins and SWD pins
+MAX32625PICO pico(
+    // vddioh_mode_t iohMode
+    //~ MAX32625PICO::IOH_OFF, // No connections to VDDIOH
+    //~ MAX32625PICO::IOH_DIP_IN, // VDDIOH input from DIP pin 1 (AIN0)
+    //~ MAX32625PICO::IOH_SWD_IN, // VDDIOH input from SWD pin 1
+    MAX32625PICO::IOH_3V3, // VDDIOH = 3.3V from local supply
+    //~ MAX32625PICO::IOH_DIP_OUT, // VDDIOH = 3.3V output to DIP pin 1
+    //~ MAX32625PICO::IOH_SWD_OUT, // VDDIOH = 3.3V output to SWD pin 1
+    //
+    // vio_t dipVio = MAX32625PICO::VIO_1V8 or MAX32625PICO::VIO_IOH
+    //~ MAX32625PICO::VIO_1V8, // 1.8V IO (local)
+    MAX32625PICO::VIO_IOH, // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
+    //
+    // vio_t swdVio
+    //~ MAX32625PICO::VIO_1V8  // 1.8V IO (local)
+    MAX32625PICO::VIO_IOH  // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V)
+    );
 //#define USE_LEDS 0 ?
 #define analogIn4_IS_HIGH_RANGE_OF_analogIn0 1
 #warning "TARGET_MAX32625PICO not previously tested; need to verify ADC_FULL_SCALE_VOLTAGE..."
@@ -1545,7 +1578,7 @@
     ADC_FULL_SCALE_VOLTAGE, // analogIn13
     ADC_FULL_SCALE_VOLTAGE, // analogIn14
     ADC_FULL_SCALE_VOLTAGE // analogIn15
-#elif defined(TARGET_MAX32625MBED)
+#elif defined(TARGET_MAX32625MBED) || defined(TARGET_MAX32625PICO)
     ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn0 // fullscale is 1.2V
     ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn1 // fullscale is 1.2V
     ADC_FULL_SCALE_VOLTAGE * 1.0f, // analogIn2 // fullscale is 1.2V
@@ -1635,6 +1668,9 @@
 #elif defined(TARGET_MAX32625MBED)
 # define LED_ON  0
 # define LED_OFF 1
+#elif defined(TARGET_MAX32625PICO)
+# define LED_ON  0
+# define LED_OFF 1
 //--------------------------------------------------
 // TODO1: TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM
 #elif defined(TARGET_LPC1768)
@@ -1702,12 +1738,36 @@
 #define D11 P1_1
 #define D12 P1_2
 #define D13 P1_0
+#elif defined(TARGET_MAX32625PICO)
+#warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
+#define A0 AIN_1
+#define A1 AIN_2
+// #define A2 AIN_3
+// #define A3 AIN_0
+#define D0 P0_0
+#define D1 P0_1
+#define D2 P0_2
+#define D3 P0_3
+#define D4 P1_7
+#define D5 P1_6
+#define D6 P4_4
+#define D7 P4_5
+#define D8 P4_6
+#define D9 P4_7
+#define D10 P0_7
+#define D11 P0_6
+#define D12 P0_5
+#define D13 P0_4
 #endif
 
 // example code declare SPI interface (GPIO controlled CS)
 #if defined(TARGET_MAX32625MBED)
 SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625MBED: P1_1 P1_2 P1_0 Arduino 10-pin header D11 D12 D13
 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10
+#elif defined(TARGET_MAX32625PICO)
+#warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
+SPI spi(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625PICO: pin P0_5 P0_6 P0_4
+DigitalOut spi_cs(SPI0_SS); // TARGET_MAX32625PICO: pin P0_7
 #elif defined(TARGET_MAX32600MBED)
 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
 DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10
@@ -5851,6 +5911,8 @@
         // example code: serial port banner message
     #if defined(TARGET_MAX32625MBED)
         serial.printf("MAX32625MBED ");
+    #elif defined(TARGET_MAX32625PICO)
+        serial.printf("MAX32625PICO ");
     #elif defined(TARGET_MAX32600MBED)
         serial.printf("MAX32600MBED ");
     #elif defined(TARGET_NUCLEO_F446RE)
--- a/Test_Menu_MAX11410.cpp	Fri Jun 05 00:33:19 2020 +0000
+++ b/Test_Menu_MAX11410.cpp	Tue Oct 27 01:04:03 2020 +0000
@@ -63,9 +63,20 @@
 //      - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/
 //      - not tested yet
 //   - MAX32625PICO
+//      - #include "max32625pico.h"
+//      - add https://os.mbed.com/users/switches/code/max32625pico/
 //      - remove max32630fthr library (if present)
 //      - remove MAX32620FTHR library (if present)
 //      - not tested yet
+//      - see https://os.mbed.com/users/switches/code/max32625pico/
+//      - see https://os.mbed.com/users/switches/code/PICO_board_demo/
+//      - see https://os.mbed.com/users/switches/code/PICO_USB_I2C_SPI/
+//      - see https://os.mbed.com/users/switches/code/SerialInterface/
+//      - Note: To load the MAX32625PICO firmware, hold the button while
+//        connecting the USB cable, then copy firmware bin file 
+//        to the MAINTENANCE drive.
+//      - see https://os.mbed.com/platforms/MAX32625PICO/
+//      - see https://os.mbed.com/teams/MaximIntegrated/wiki/MAX32625PICO-Firmware-Updates
 //
 // end Platform_Include_Boilerplate
 #include "MAX11410.h"
@@ -899,6 +910,11 @@
 // CODE GENERATOR: generate * command read/write reg *reg? *reg=value
         case '*':
         {
+            // respond to SCPI query "*idn?" with device id string
+            if ((strcmp(cmdLine.str(), "*idn?") == 0) || (strcmp(cmdLine.str(), "*IDN?") == 0)) {
+                cmdLine.serial().printf("MAXIM,MAX11410\r\n");
+                return true; // command handled by MAX11410
+            }
             // if buffer starts with a regName:
             // for each reg value (0..n) if(cmdLine.has_keyword(device.regName(r))):
             cmdLine.serial().printf(" scan RegName...\r\n");