Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Legacy microcontrollers Forum Discussions

Not applicable
Greeting,

I'm learning on how to use the XMC Flash emulated EEPROM and I have studied the APP help of E_EEPROM_XMC1.

I configured the app as the help manual demonstrates, and used then build the same application code to run on my XMC1300 boot kit.

But how could I debug and verify those data I want to stored has already been stored to the right flash address? I'm thinking of using "memory view" to debug however nothing but "?????????" could be found on each columns like I posted below:

2128.attach

Any suggestion would be very appreciated!


regards,

Fender


// This sample application writes 3 block in sequence with the first block repeated twice.
// All three blocks are read back. While verifying data elements "motor_data" block shall have latest data.
// Before start, make sure that the flash shall not contain any data in the EEPROM area. Else erase the flash area
// using xmc1_flash LLD API XMC_FLASH_ErasePages( (uint32_t*)E_EEPROM_XMC1_FLASH_BANK0_BASE,16) before Dave_Init()
// called.
#include
int main(void)
{
DAVE_STATUS_t status;
E_EEPROM_XMC1_OPERATION_STATUS_t oper_status;

uint8_t Index;
uint8_t ReadBuffer1[12];
uint8_t ReadBuffer2[32];
uint8_t ReadBuffer3[100];
uint8_t data_buffer[100];

// Fill the buffer with incremental data from 0 to 100
for(Index = 0; Index<100;Index++)
{ data_buffer[Index] = Index; }

//Clear the Read buffer before accepting the read request
for(Index = 0; Index<12;Index++)
{ ReadBuffer1[Index] = 0; }

//Clear the Read buffer before accepting the read request
for(Index = 0; Index<32;Index++)
{ ReadBuffer2[Index] = 0; }

//Clear the Read buffer before accepting the read request
for(Index = 0; Index<100;Index++)
{ ReadBuffer3[Index] = 0; }

// Before start, make sure that the flash shall not contain any data in the EEPROM area. Else erase the EEPROM area
// using xmc1_flash LLD API XMC_FLASH_ErasePages() API shown below. Enable the below commented code and build.
// Once the example runs successfully, remove the line from future builds to ensure data retention.

// XMC_FLASH_ErasePages( (uint32_t*)E_EEPROM_XMC1_FLASH_BANK0_BASE,16);

status = DAVE_Init(); // Initialization of DAVE APPs

// Write the first copy of the motor_data into active bank of EEPROM
if (status == DAVE_STATUS_SUCCESS)
{
oper_status = E_EEPROM_XMC1_Write(motor_data,data_buffer);
}
// Write the first copy of the sensor_data into active bank of EEPROM
if(oper_status == E_EEPROM_XMC1_OPERATION_STATUS_SUCCESS)
{
oper_status = E_EEPROM_XMC1_Write(sensor_data,data_buffer);
}
// Write the first copy of the lamp_config_data into active bank of EEPROM
if(oper_status == E_EEPROM_XMC1_OPERATION_STATUS_SUCCESS)
{
oper_status = E_EEPROM_XMC1_Write(lamp_config_data,data_buffer);
}

// Refill the data buffer with new values starting from 255 to 155
for(Index = 0; Index<100; Index++)
{ data_buffer[Index] = (255 - Index); }

// Write the second copy of the motor_data into active bank of EEPROM
if (status == DAVE_STATUS_SUCCESS)
{
oper_status = E_EEPROM_XMC1_Write(motor_data,data_buffer);
}

// Read the latest copies of the written blocks from the active bank
if(oper_status == E_EEPROM_XMC1_OPERATION_STATUS_SUCCESS)
{
oper_status = E_EEPROM_XMC1_Read(motor_data,0U,ReadBuffer1,12U);
}
if(oper_status == E_EEPROM_XMC1_OPERATION_STATUS_SUCCESS)
{
oper_status = E_EEPROM_XMC1_Read(sensor_data,0U,ReadBuffer2,32U);
}
if(oper_status == E_EEPROM_XMC1_OPERATION_STATUS_SUCCESS)
{
oper_status = E_EEPROM_XMC1_Read(lamp_config_data,0U,ReadBuffer3,100U);
}

while(1)
{}
}
0 Likes
1 Reply
Not applicable
Could somebody help? thanks.


Regards,

Fender
0 Likes