Internal Flash read/write operation in km34

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Internal Flash read/write operation in km34

1,099件の閲覧回数
RajPadmani
Contributor II

Hello everyone,

 

I am working on the km34, i wants to read/write in the internal flash of the km34. but my problem is when i am write on the flash while interrupt of ADC and timer it reset or generate the hardfault error. so i change the vector table into the ram and assign the address of the new vector table location to the VTOR, still i am not able write on the internal flash of the km34, still it continuous reset the code.

thank you 

0 件の賞賛
返信
3 返答(返信)

1,076件の閲覧回数
Joey_z
NXP Employee
NXP Employee

hi,RajPadmani

Thank you for your interest in NXP Semiconductor products and the opportunity to serve you, I will gladly help you with this.

Interrupts are not allowed during Flash read and write operations. Ensure that all unnecessary interrupts are disabled before performing flash read and write operations. If you have already moved the vector table to RAM and are still encountering issues, try checking whether the NVIC's VTOR register is correctly set and ensure that the RAM region is initialized and available.

BR

Xu Zhang

0 件の賞賛
返信

1,048件の閲覧回数
RajPadmani
Contributor II
Thank you for your reply,

I create a partition into ram for Vector table and isr handler for adc and timer like

ram_isr (NOLOAD) :
{
KEEP(*(.Vector_ram))
KEEP(*(.ISR_ram))
KEEP(*(ADC_ISR))
} > SRAM_8

Declare them like
__attribute__((section(".ISR_ram"))) void Custom_ADC16_IRQ_HANDLER_FUNC(void)
{
g_Adc16ConversionDoneFlag = true;
/* Read conversion result to clear the conversion completed flag. */
g_Adc16ConversionValue = ADC16_GetChannelConversionValue(DEMO_ADC16_BASE, DEMO_ADC16_CHANNEL_GROUP);
ADC16_SetChannelConfig(DEMO_ADC16_BASE, DEMO_ADC16_CHANNEL_GROUP, &adc16ChannelConfigStruct);
g_Adc16InterruptCounter++;
SDK_ISR_EXIT_BARRIER;
}

__attribute__((section(".ISR_ram"))) void Custom_TMR1_IRQHandler(void)
{
/* Clear interrupt flag.*/
QTMR_ClearStatusFlags(TMR1, kQTMR_CompareFlag);
tmr_count++;
// PRINTF("\r\n Timer interrupt has occurred !");
// qtmrIsrFlag = true;
SDK_ISR_EXIT_BARRIER;
}

for vector table
unsigned int __attribute__((section(".Vector_ram"))) g_vectorTable[49];
__disable_irq();
DisableGlobalIRQ();
memcpy(g_vectorTable, (unsigned int *)SCB->VTOR, sizeof(uint32_t) * 48);
SCB->VTOR = &g_vectorTable;
__enable_irq();


the main thing for my project is i don't want to disable the interrupt while flash operation i need them. and i also move the isr handler into ram but still not write/read on particular address of the ram. please provide any suggestion or solutiond.

Thank you
0 件の賞賛
返信

1,013件の閲覧回数
Joey_z
NXP Employee
NXP Employee

Hi,RajPadmani

You mentioned that you do not want to disable interrupts during Flash operations. If the interrupt vector table is in the same block as the flash area you want to write to, you can't enter the interrupt while reading or writing flash. Make sure the interrupt vector table is not in the same block as the flash area you are writing to.
In addition, sometimes in order not to affect the erase flash, you can put the interrupt vector table in RAM, but the interrupt vector table and the interrupt service program must be placed in RAM, and the VTOR reg must be modified. If you use SRAM_8 in your application, check that your linker script defines the SRAM_8 region correctly and that it is not used by other parts.

BR

Xu Zhang

0 件の賞賛
返信