All the demos that feature external flash memory needs to be programmed with demo data.
Each respective project that features external memory usage has a built in programming mode.
The hex files programmed into the external memory are located in the “Resources” directory of each demo. The hex files are named “ExternalResource-XXX.hex (where: XXX are replaced by the demo name with some appropriate strings to further differentiate the hex files in case there are multiple files). Programming the hex files to the external memory can be performed using the “memory_programmer.jar” utility located at <install dir>/Microchip/Graphics/bin/memory_programmer/ directory. Please refer to the help file of the utility for details of usage.
On the firmware side the following instructions illustrate how to implement external memory programming capability into your application.
Setting up the External Memory Programming Mode
There are two ways to program the external flash memory on the demo boards used.
· UART Mode
· USB Device Mode
The table below enumerates the required files for each mode.
Programming Mode |
Mode Specific Files |
Common Files Files are distributed under <install dir>/Graphics/Common directory |
UART Mode |
· UART.c · UART.h
|
· comm_pkt.c · comm_pkt.h · comm_pkt_callback.c · comm_pkt_callback.h · ExternalMemory.h · FlashProgrammer.c · FlashProgrammer.h
|
USB Device Mode |
· usb_callback.c · usb_descriptors.c · usb_config.h
|
Aside from the required files, there are also macros required to enable the respective modes.
Macros required in the Hardware Profile for each mode
|
UART mode:
#define USE_COMM_PKT_MEDIA_SERIAL_PORT #define BAUDRATE2 115200UL #define BRG_DIV2 4 #define BRGH2 1
// maximum packet size is needed to be defined for both // UART and USB Device modes. #define COMM_PKT_RX_MAX_SIZE (1024)
|
USB Device mode:
#define USE_COMM_PKT_MEDIA_USB
//#define USE_SELF_POWER_SENSE_IO
// Input used for self power // Pin used must be modified to match the used hardware, // pin A2 here is just an example #define tris_self_power TRISAbits.TRISA2 #define self_power 1
// enable this macro if using USB_POLLING mode option //#define USE_USB_BUS_SENSE_IO
// Input used for bus sense #define tris_usb_bus_sense TRISBbits.TRISB5
// Special considerations required if using SESVD for // this purpose (see FRM chapter on USB). #define USB_BUS_SENSE U1OTGSTATbits.SESVD
// maximum packet size is needed to be defined for both // UART and USB Device modes. #define COMM_PKT_RX_MAX_SIZE (1024)
|
Suggested USB-Serial Converter Hardware
It is very rare to see a Serial port in new computer systems. Usually, USB ports are being used. In these cases a USB-Serial dongle is usually used to connect to the development board using the board’s serial port. The use of the MCP2200 USB to RS232 Demo Board (P/N MCP2200EV-VCP) instead of the dongle results in a more reliable connection.