PIC32MZ DA DDR Example Questions
I am using the PIC32MZ DA Starter kit with internal DDR memory and trying to determine how to read/write to the internal DDR. The DDR example in Harmony 2.05.1 doesn't have any comments on the FSM used to perform the read/write operations and I am having trouble puzzling through how the code accesses the DDR. Here is an excerpt from the DDR the FSM:
if(BSP_SWITCH_STATE_PRESSED == BSP_SwitchStateGet(BSP_SWITCH_1))
appData.state = APP_STATE_INIT;
if(appData.count == 0)
appData.count = LED_TOGGLE_COUNT;
if ( appData.addr < (DDR_START + MEM_SIZE))
strt_addr = appData.addr;
while (appData.addr < strt_addr + READ_WRITE_BLOCK)
(*(volatile unsigned int *)(appData.addr)) = appData.addr;
appData.addr += 4;
appData.addr = DDR_START;
appData.state = APP_STATE_READ;
appData.count = 0;
I changed the text of the only code that makes sense as performing the write operation to the DDR but to me it only looks like the code is incrementing the data address counter as there are no other functions called to access the DDR and no actual data is ever defined in the example. Am I missing something as it seems like this example is just counting up, then down, and flashing different LED's during the different states and never actually accessing the DDR? The main.c only calls the sys_tasks function which only calls the Application FSM...
The program builds and programs fine (and the LEDs flash in the proper sequence) but I can't tell if the DDR is actually being written to or read from.
Thanks in advance!!
P.S. I assume that the internal DDR memory is volatile and that if I wish to store variables/data that I will need an external EEPROM, correct? Or is there another non-volatile storage medium that I can use to store variables when the PIC loses power (I don't see anything in the datasheet for the PIC32MZ DA series)?