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

Dependencies:   MaximTinyTester CmdLine MAX541 USBDevice

Revision:
67:5b8a495dda1c
Parent:
66:3fe92f6f1cfa
Child:
69:989e392cf635
--- a/MAX11043/MAX11043.cpp	Wed Feb 19 22:47:05 2020 +0000
+++ b/MAX11043/MAX11043.cpp	Thu Feb 20 01:16:25 2020 +0000
@@ -142,7 +142,9 @@
     // SPI CS = ActiveLow
     // SPI FrameStart = CS
     m_SPI_cs_state = 1;
-    m_cs_pin = m_SPI_cs_state;
+    if (m_cs_pin.is_connected()) { // avoid mbed runtime error if pin is NC not connected
+        m_cs_pin = m_SPI_cs_state;
+    }
 
     // SPI CPOL = 0
     // SPI CPHA = 0
@@ -208,7 +210,9 @@
     // CODE GENERATOR: extern function definition for function SPIoutputCS
     // CODE GENERATOR: extern function definition for standard SPI interface function SPIoutputCS(int isLogicHigh)
     m_SPI_cs_state = isLogicHigh;
-    m_cs_pin = m_SPI_cs_state;
+    if (m_cs_pin.is_connected()) { // avoid mbed runtime error if pin is NC not connected
+        m_cs_pin = m_SPI_cs_state;
+    }
 }
 
 // CODE GENERATOR: extern function requirement MAX11043::SPIreadWriteWithLowCS
@@ -229,9 +233,13 @@
     //
     //~ digitalWrite(Scope_Trigger_Pin, LOW); // diagnostic Scope_Trigger_Pin
     //
-    m_cs_pin = 0;
+    if (m_cs_pin.is_connected()) { // avoid mbed runtime error if pin is NC not connected
+        m_cs_pin = 0;
+    }
     unsigned int numBytesTransferred = m_spi.write((char*)mosiData, byteCount, (char*)misoData, byteCount);
-    m_cs_pin = m_SPI_cs_state;
+    if (m_cs_pin.is_connected()) { // avoid mbed runtime error if pin is NC not connected
+        m_cs_pin = m_SPI_cs_state;
+    }
     //
     //~ digitalWrite(Scope_Trigger_Pin, HIGH); // diagnostic Scope_Trigger_Pin
     //