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

Dependencies:   MaximTinyTester CmdLine MAX541 USBDevice

Files at this revision

API Documentation at this revision

Comitter:
whismanoid
Date:
Fri Feb 21 10:40:45 2020 +0000
Parent:
69:989e392cf635
Child:
71:62bcd01ea87f
Commit message:
WIP #define MAX11043_EOC_INTERRUPT_POLLING 0; need test

Changed in this revision

MAX11043/MAX11043.cpp Show annotated file Show diff for this revision Revisions of this file
MAX11043/MAX11043.h Show annotated file Show diff for this revision Revisions of this file
Test_Main_MAX11043.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MAX11043/MAX11043.cpp	Fri Feb 21 00:45:32 2020 +0000
+++ b/MAX11043/MAX11043.cpp	Fri Feb 21 10:40:45 2020 +0000
@@ -157,7 +157,7 @@
     m_EOC_pin(EOC_pin), // Digital Event Output from MAX11043 device
 #else // MAX11043_EOC_INTERRUPT_POLLING
 // MAX11043 EOC End Of Conversion input is InterruptIn(PinName:EOC_pin).fall(onEOCFallingEdge);
-    // m_EOC_pin(EOC_pin), // Digital Event Output from MAX11043 device
+    m_EOC_pin(EOC_pin), // Digital Event Output from MAX11043 device
 #endif // MAX11043_EOC_INTERRUPT_POLLING
     // CODE GENERATOR: class constructor initializer list ic_variant
     m_ic_variant(ic_variant)
@@ -217,6 +217,7 @@
     // TODO: onEOCFallingEdge: interrupt handler requires global object extern MAX11043 g_MAX11043_device
     InterruptIn interruptEOC(EOC_pin); // InterruptIn constructor requires PinName, not DigitalIn -- Error: No instance of constructor "mbed::InterruptIn::InterruptIn"  matches the argument list in "MAX11043/MAX11043.cpp", Line: 187, Col: 31
     // TODO: onEOCFallingEdge: replace DigitalIn &EOC_pin with PinName EOC_pin, so that I can create an InterruptIn(PinName:EOC_pin)
+    extern void onEOCFallingEdge(void);
     interruptEOC.fall(&onEOCFallingEdge);
 #endif // MAX11043_EOC_INTERRUPT_POLLING
 
--- a/MAX11043/MAX11043.h	Fri Feb 21 00:45:32 2020 +0000
+++ b/MAX11043/MAX11043.h	Fri Feb 21 10:40:45 2020 +0000
@@ -69,7 +69,7 @@
 // EOC# asserts low when new data is available.
 // Initiate a data read prior to the next rising edge of EOC# or the result is overwritten.
 #ifndef MAX11043_EOC_INTERRUPT_POLLING
-#define MAX11043_EOC_INTERRUPT_POLLING 1
+#define MAX11043_EOC_INTERRUPT_POLLING 0
 #endif // MAX11043_EOC_INTERRUPT_POLLING
 //--------------------------------------------------
 // MAX11043 ADC Read operations must be synchronized to EOC End Of Conversion
@@ -735,7 +735,20 @@
 // OutputPin Name = EOC
 // OutputPin Description = End of Conversion Output. Active-Low End-of-Conversion Indicator. EOC asserts low to indicate that new data is ready.
 // OutputPin Function = Event
+//--------------------------------------------------
+// MAX11043 ADC Read operations must be synchronized to EOC End Of Conversion
+// EOC# asserts low when new data is available.
+// Initiate a data read prior to the next rising edge of EOC# or the result is overwritten.
+#if MAX11043_EOC_INTERRUPT_POLLING
+// MAX11043 EOC End Of Conversion input should be InterruptIn(PinName:EOC_pin).fall(onEOCFallingEdge);
+// Workaround using DigitalIn(PinName:EOC_pin) polled to sync with EOC falling edge for ADC reads
+// 2020-02-20 MAX11043_EOC_INTERRUPT_POLLING works on MAX32625MBED at 9us conversion rate, with 1us timing margin
     DigitalIn &m_EOC_pin;
+#else // MAX11043_EOC_INTERRUPT_POLLING
+// MAX11043 EOC End Of Conversion input is InterruptIn(PinName:EOC_pin).fall(onEOCFallingEdge);
+    InterruptIn &m_EOC_pin;
+#endif // MAX11043_EOC_INTERRUPT_POLLING
+//--------------------------------------------------
 //
 
     // Identifies which IC variant is being used
--- a/Test_Main_MAX11043.cpp	Fri Feb 21 00:45:32 2020 +0000
+++ b/Test_Main_MAX11043.cpp	Fri Feb 21 10:40:45 2020 +0000
@@ -1719,7 +1719,27 @@
 DigitalOut SHDN_pin(D8); // Digital Configuration Input to MAX11043 device
 DigitalOut DACSTEP_pin(D7); // Digital Configuration Input to MAX11043 device
 DigitalOut UP_slash_DWNb_pin(D6); // Digital Configuration Input to MAX11043 device
+//--------------------------------------------------
+// MAX11043 ADC Read operations must be synchronized to EOC End Of Conversion
+// EOC# asserts low when new data is available.
+// Initiate a data read prior to the next rising edge of EOC# or the result is overwritten.
+#ifndef MAX11043_EOC_INTERRUPT_POLLING
+#define MAX11043_EOC_INTERRUPT_POLLING 1
+#endif // MAX11043_EOC_INTERRUPT_POLLING
+//--------------------------------------------------
+// MAX11043 ADC Read operations must be synchronized to EOC End Of Conversion
+// EOC# asserts low when new data is available.
+// Initiate a data read prior to the next rising edge of EOC# or the result is overwritten.
+#if MAX11043_EOC_INTERRUPT_POLLING
+// MAX11043 EOC End Of Conversion input should be InterruptIn(PinName:EOC_pin).fall(onEOCFallingEdge);
+// Workaround using DigitalIn(PinName:EOC_pin) polled to sync with EOC falling edge for ADC reads
+// 2020-02-20 MAX11043_EOC_INTERRUPT_POLLING works on MAX32625MBED at 9us conversion rate, with 1us timing margin
 DigitalIn EOC_pin(D2); // Digital Event Output from MAX11043 device
+#else // MAX11043_EOC_INTERRUPT_POLLING
+// MAX11043 EOC End Of Conversion input is InterruptIn(PinName:EOC_pin).fall(onEOCFallingEdge);
+InterruptIn EOC_pin(D2); // Digital Event Output from MAX11043 device
+#endif // MAX11043_EOC_INTERRUPT_POLLING
+//--------------------------------------------------
 // example code declare device instance
 MAX11043 g_MAX11043_device(spi, spi_cs, CONVRUN_pin, SHDN_pin, DACSTEP_pin, UP_slash_DWNb_pin, EOC_pin, MAX11043::MAX11043_IC);