MAX32620HSP (MAXREFDES100) RPC Example for Graphical User Interface

Dependencies:   USBDevice

Fork of HSP_Release by Jerry Bradshaw

This is an example program for the MAX32620HSP (MAXREFDES100 Health Sensor Platform). It demonstrates all the features of the platform and works with a companion graphical user interface (GUI) to help evaluate/configure/monitor the board. Go to the MAXREFDES100 product page and click on "design resources" to download the companion software. The GUI connects to the board through an RPC interface on a virtual serial port over the USB interface.

The RPC interface provides access to all the features of the board and is available to interface with other development environments such Matlab. This firmware provides realtime data streaming through the RPC interface over USB, and also provides the ability to log the data to flash for untethered battery operation. The data logging settings are configured through the GUI, and the GUI also provides the interface to download logged data.

Details on the RPC interface can be found here: HSP RPC Interface Documentation

Windows

With this program loaded, the MAX32620HSP will appear on your computer as a serial port. On Mac and Linux, this will happen by default. For Windows, you need to install a driver: HSP serial port windows driver

For more details about this platform and how to use it, see the MAXREFDES100 product page.

Revision:
2:d483f896c7a9
Parent:
1:9490836294ea
Child:
3:8e9b9f5818aa
--- a/HSP/LoggingService/Logging_RPC.cpp	Fri Apr 21 12:12:30 2017 -0500
+++ b/HSP/LoggingService/Logging_RPC.cpp	Fri Apr 21 18:10:37 2017 -0500
@@ -167,55 +167,25 @@
 #define PAGE_INC_4K 0x10
 #define TOTAL_SECTOR_NUMBER 263
 
+
+#define ADDRESS_INC_4K      0x1000
+#define ADDRESS_INC_32K     0x8000
+#define ADDRESS_INC_64K     0x10000
+
+#define ADDRESS_4K_START      0x0
+#define ADDRESS_4K_END        0x8000  
+  
+#define ADDRESS_32K_START     0x8000
+#define ADDRESS_32k_END       0x10000  
+  
+#define ADDRESS_64K_START     0x10000
+#define ADDRESS_64k_END       0x2000000  
+
+#define SIZE_OF_EXTERNAL_FLASH  0x2000000 // 33,554,432 Bytes
+
 //******************************************************************************
 int Logging_EraseWrittenSectors(char argStrs[32][32], char replyStrs[32][32]) {
-  uint32_t reply[1];
-  uint8_t data[512];
-  uint32_t address;
-  uint32_t pageNumber;
-  uint32_t pageEmpty;
-  uint32_t currentSector;
-
-  pageNumber = PAGE_INC_4K;
-  address = SECTOR_SIZE_4K;
-  currentSector = 0;
-  printf("Logging_EraseWrittenSectors ");
-  fflush(stdout);
-  printf("pageNumber %d 0x%X ", (unsigned int)pageNumber, (unsigned int)pageNumber);
-  fflush(stdout);
-  printf("SECTOR_SIZE_4K %d 0x%X ...", SECTOR_SIZE_4K, SECTOR_SIZE_4K);
-  fflush(stdout);
-  // always erase this sector... the first part is used for the mission resume
-  // table
-  Peripherals::s25FS512()->sectorErase_Helper(address);
-  address += SECTOR_SIZE_4K;
-  while (currentSector < TOTAL_SECTOR_NUMBER) {
-    // sample the page
-    pageNumber = address >> 8;
-    Peripherals::s25FS512()->readPages_Helper(pageNumber, pageNumber, data, 0);
-    pageEmpty = Peripherals::s25FS512()->isPageEmpty(data);
-    if (pageEmpty == 0) {
-      Peripherals::s25FS512()->sectorErase_Helper(address);
-    } else {
-      // stop processing... all of the sectors from here on out should be empty
-      // printf("Logging_EraseWrittenSectors break ");  fflush(stdout);
-      // break;
-    }
-    currentSector++;
-    if (currentSector < 8) {
-      address += SECTOR_SIZE_4K;
-    }
-    if (currentSector == 8) {
-      address = SECTOR_SIZE_256K;
-    }
-    if (currentSector > 8) {
-      address += SECTOR_SIZE_256K;
-    }
-  }
-  reply[0] = 0x80;
-  FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
-  printf("Logging_EraseWrittenSectors done. \n");
-  fflush(stdout);
+  Peripherals::s25FS512()->bulkErase_Helper();
   return 0;
 }