By looking at eeprom SDK example, I understood that there is an api only for writing to eeprom using -
My requirement is now to read back the same but looks like api is not implemented for that. I wanted to write 4 to 8 my app specific bytes in eeprom to read during bootup or after reset.
What I assume is that one can use -
解決済! 解決策の投稿を見る。
Hello Gmk 9
You can use the functions IAP_ReadEEPROMPage() and EEPROM_WritePage() without any issue.
EEPROM_WritePage needs 3 parameters to use it
* param base - EEPROM peripheral base address.
* param pageNum - Page number to be written.
* param data - Data need be written. This array data size shall equal to the page size.
The IAP_ReadEEPROMPage() receives the following parameters.
* param pageNumber - EEPROM page number.
* param dstAddr - Memory address to store the value read from EEPROM.
* param systemCoreClock - Current core clock frequency in kHz.
You can refer to the SDK example "iap_eeprom", in that example the functions IAP_ReadEEPROMPage() and IAP_ReadEEPROMPage() are used. To write in EEPROM you can use the function you prefer.
Let me know if this is helpful, If you have more questions do not hesitate to ask me.
Best regards,
Omar
Hello Gmk 9
You can use the functions IAP_ReadEEPROMPage() and EEPROM_WritePage() without any issue.
EEPROM_WritePage needs 3 parameters to use it
* param base - EEPROM peripheral base address.
* param pageNum - Page number to be written.
* param data - Data need be written. This array data size shall equal to the page size.
The IAP_ReadEEPROMPage() receives the following parameters.
* param pageNumber - EEPROM page number.
* param dstAddr - Memory address to store the value read from EEPROM.
* param systemCoreClock - Current core clock frequency in kHz.
You can refer to the SDK example "iap_eeprom", in that example the functions IAP_ReadEEPROMPage() and IAP_ReadEEPROMPage() are used. To write in EEPROM you can use the function you prefer.
Let me know if this is helpful, If you have more questions do not hesitate to ask me.
Best regards,
Omar
@Omar Anguiano
Can I use IAP_ReadEEPROMPage() or EEPROM_WritePage() during program execution?
I can observe controller is getting reset internally and that's a big problem!
How to use IAP_ReadEEPROMPage() during program execution?
Hello Gmk 9
The reset is not an expected behavior during the execution of the command. You can confirm the source of the reset with the System Reset Status Register SYSRSTSTAT. It could be helpful if you provide me the reset source so we can avoid the reset during the execution.
If you have more questions do not hesitate to ask me.
Best regards,
Omar
Hi Omar, looks like controller is not getting to RST state but GPIOs are toggling during execution of EEPROM related activities.
This behaviour looks very strange.
Any comments on this?
Hello Gmk 9
Can you detail this issue? How the GPIO's are configured? Does the GPIO have the interruptions enabled?
I agree with you, it is a strange behavior since the EEPROM_WritePage and IAP_ReadEEPROMPage functions don't use any GPIO operations.
It would be helpful if you share me your configuration.
Best regards,
Omar
GPIO config code below. No interrupts configured. -
void alarm_fb_gpio_init(void)
{
IOCON->PIO[3][4]= 0x00000120;
IOCON->PIO[3][5]= 0x00000120; // Mains out of range
IOCON->PIO[3][6]= 0x00000120; // Emergency push button
IOCON->PIO[3][7]= 0x00000120; // Mains fail
IOCON->PIO[3][8]= 0x00000120;
IOCON->PIO[3][9]= 0x00000120;
IOCON->PIO[3][10]= 0x00000120;
IOCON->PIO[3][11]= 0x00000120; // Backdoor-1 open
IOCON->PIO[3][12]= 0x00000120; // Backdoor-2 open
IOCON->PIO[3][14]= 0x00000120; // Spare-1
IOCON->PIO[3][15]= 0x00000120; // Spare-2
// Set as input pins
GPIO->DIRCLR[3] |= (1<<4) | (1<<5) | (1<<6) | (1<<7) \
| (1<<8) | (1<<9) | (1<<10)| (1<<11)\
| (1<<12)| (1<<14)| (1<<15);
CLOCK_EnableClock(kCLOCK_Gpio5);
// GPIO for Doors open buzzer indication
IOCON->PIO[5][0]= 0x00000120;
// Set as output pin
GPIO->DIR[5] |= (1<<0);
// GPIO for Doors open buzzer indication
IOCON->PIO[5][1]= 0x00000120;
// Set as output pin
GPIO->DIR[5] |= (1<<1);
}
Hello Gmk 9
The IOCON registers are well written, the SDK examples initialize the IOCON with the same values (0x120), I suggest you enable the rest of GPIO's clocks before writing in the IOCON registers.
I see that the GPIO directions are configured as an output, for making the GPIO input you can either use the function
GPIO_PinInit(GPIO_Type *base, uint32_t port, uint32_t pin, const gpio_pin_config_t *config)
Or write:
GPIO->DIR[port] &= ~(1<<pin);
Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar
Thanks for the reply Mr Omar...
In "iap_eeprom" example IAP_ReadEEPROMPage() and IAP_WriteEEPROMPage() are used and not the EEPROM_WritePage().
I have done some trails before posting my query here. Below is my observation.
Combination of IAP_ReadEEPROMPage() and IAP_WriteEEPROMPage() is not working properly for me which IDK why!
On the other hand, combination of IAP_ReadEEPROMPage() and EEPROM_WritePage() is working.
You can test it by yourself.
I'll continue with the working solution as it serves my purpose.
Gmk