MAX32620HSP (MAXREFDES100) RPC Example for Graphical User Interface
Dependencies: USBDevice
Fork of HSP_Release by
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.
Diff: HSP/Devices/S25FS256/S25FS512.cpp
- Revision:
- 3:8e9b9f5818aa
- Parent:
- 1:9490836294ea
diff -r d483f896c7a9 -r 8e9b9f5818aa HSP/Devices/S25FS256/S25FS512.cpp --- a/HSP/Devices/S25FS256/S25FS512.cpp Fri Apr 21 18:10:37 2017 -0500 +++ b/HSP/Devices/S25FS256/S25FS512.cpp Tue Apr 25 10:47:10 2017 -0500 @@ -124,6 +124,7 @@ return reg_write_read_multiple_quad(cmdArray,5,flashBuffer,0); } +//****************************************************************************** int8_t S25FS512::writeAnyRegister4Wire(uint32_t address, uint8_t data) { uint8_t cmdArray[5]; cmdArray[0] = 0x71; @@ -133,6 +134,7 @@ cmdArray[4] = data; return reg_write_read_multiple_4Wire(cmdArray, 5, flashBuffer, 5); } + //****************************************************************************** int8_t S25FS512::writeRegisters(void) { uint8_t cmdArray[3]; @@ -144,7 +146,6 @@ return 0; } - //****************************************************************************** int8_t S25FS512::readAnyRegister(uint32_t address, uint8_t *data, uint32_t length) { uint8_t cmdArray[4]; @@ -269,6 +270,41 @@ } //****************************************************************************** +int8_t S25FS512::quadIoRead_PartialPage(uint32_t address, uint8_t *buffer, uint32_t numberOfBytesInPage) { + uint8_t cmdArray[5]; + uint8_t *ptr; + uint8_t last; + uint32_t packetSize; + uint32_t xferCount; + cmdArray[0] = 0xEC; //0xEB; + cmdArray[1] = (address >> 24) & 0xFF; + cmdArray[2] = (address >> 16) & 0xFF; + cmdArray[3] = (address >> 8) & 0xFF; + cmdArray[4] = (address >> 0) & 0xFF; + //reg_write_read_multiple_quad(cmdArray,4,flashBuffer,32); + ptr = buffer; + last = 0; + // only send the command + reg_write_read_multiple_quad_last(cmdArray, 5, ptr, 0, 0); + //wait_ms(1); + reg_write_read_multiple_quad_last(cmdArray, 0, ptr, 5, 0); + //wait_ms(1); + + xferCount = 0; + do { + packetSize = 64; + if ((xferCount + packetSize) > numberOfBytesInPage) { + packetSize = numberOfBytesInPage; + last = 1; + } + reg_write_read_multiple_quad_last(cmdArray,0,ptr,packetSize, 0); + xferCount += packetSize; + ptr += packetSize; + } while (last != 1); + return 0; +} + +//****************************************************************************** int8_t S25FS512::checkBusy(void) { uint8_t cmdArray[5]; cmdArray[0] = 0x05; @@ -294,7 +330,7 @@ //****************************************************************************** int8_t S25FS512::parameterSectorErase(uint32_t address) { - uint8_t cmdArray[5]; + uint8_t cmdArray[5]; cmdArray[0] = 0x21; //0x20 (P4E), 0x21 (4P4E) cmdArray[1] = (address >> 24) & 0xFF; cmdArray[2] = (address >> 16) & 0xFF; @@ -413,11 +449,10 @@ waitTillNotBusy(); wait_us(100); wren(); - wait_us(100); + wait_us(200); parameterSectorErase(address); wait_us(100); waitTillNotBusy(); - wait_us(100); return 0; } @@ -426,21 +461,10 @@ waitTillNotBusy(); wait_us(100); wren(); - wait_us(100); - - if (address < 0x20000) { //0x8000) { - parameterSectorErase(address); - } else { + wait_us(200); sectorErase(address); - } - //if (address < 0x20000) { - //parameterSectorErase(address); - //} else { - //sectorErase(address); - //} wait_us(100); waitTillNotBusy(); - wait_us(100); return 0; } @@ -490,4 +514,12 @@ return status; } +//****************************************************************************** +int8_t S25FS512::readPartialPage_Helper(uint32_t pageNumber, uint8_t *buffer, uint32_t count) { + int8_t status = 0; + waitTillNotBusy(); + status = quadIoRead_PartialPage((uint32_t)(pageNumber << 8), (uint8_t *)buffer, count); + return status; +} +