Hi,
I ported CANBUS interface to FRDM-K64F board by using KBOOT V2.0. It works fine with LED demo program.
Then, I change my project based on Jorge's document and it works fine as well. On my project, I am using CANBUS communication as well. When I send CANBUS packet to board, I found the CANBUS packets are received by boot-loader instead of my project because there is no receive output on my project. But, if I send "ping command", it gets accepted by boot-loader and waiting for boot-loader command.
I am using KDS3.0 with PE to build my project.
Is it possible the vector table is not changed? The CANBUS receive interrupt is in 0x0000_0000~~0x0000_0400?
How can I change interrupt vector to my project vector table?
Thanks,
Christie
已解决! 转到解答。
Hi Christie,
Maybe you can try to add __disable_irq() before changing SCB->VTOR in Bootloader, and remember to call __enable_irq() in the application to restore global irq.
Thanks,
Fan
Hi Fan,
I checked that __VECTOR_TABLE is 0x20000 in boot-loader that is the same as I set in application.
But, if I set SCB->VTOR in bootloader before jump, it will cause the problem. Could you tell me why? Is it because the vector table in 0x20000 is not set yet? But, all interrupts are disabled in bootloader? Can it be the other reason?
Thanks,
Christie
Hi Christie,
Please ensure that the SCB->VTOR is as close to the jump function as possible, and please ensure there are no pending interrupts before updating base address of vector table.
Thanks,
Fan
Hi Fan,
I just put SCB->VTOR before jump. If I added some delay(20ms), it works fine. So, you think that it is possible the pending interrupt causes problem?
If I set the SCB-VTOR after initialization, it works as well. Both options should be fine, right?
Thanks,
Christie
Hi Fan,
I checked the boot-loader, SCB->VTOR is set to 0 instead of 0xA000 before it jumps to application, why? I am using freedom_bootloader as my project. Do I am using wrong one?
So, I should set it to 0xA000 in my application?
In my application link file, I already change the address, I still need to set SCB->VTOR = 0xA000?
Regards,
Christie
Hi Fan,
I check the VTOR setting is my project as follows:
if (__VECTOR_RAM != __VECTOR_TABLE)
{
/* Copy the vector table from ROM to RAM */
for (n = 0; n < ((uint32_t)__RAM_VECTOR_TABLE_SIZE)/sizeof(uint32_t); n++)
{
__VECTOR_RAM[n] = __VECTOR_TABLE[n];
}
/* Point the VTOR to the position of vector table */
SCB->VTOR = (uint32_t)__VECTOR_RAM;
}
else
{
/* Point the VTOR to the position of vector table */
SCB->VTOR = (uint32_t)__VECTOR_TABLE;
}
__VECTOR_RAM = 0x1FFF_0000
__VECTOR_TABLE = 0x0002_0000 // because I set the application in 0x0002_0000
__RAM_VECTOR_TABLE_SIZE= 0x0000_0400
Looks like the settings are right?
Regards,
Christie
Hi Christie,
Please check the linker file, I vaguely remember that the default setting is __VECTOR_RAM equals to __VECTOR_TABLE, so the code you posted doesn’t’ take effect.
Actually, there are two options, you can either use SCB->VTOR= in your application or put this code in bootloader before jumping to the application.
Best Regards,
Fan
Hi Fan,
Looks like that I have to remove "SCB->VTOR = (uint32_t)__VECTOR_TABLE" before it jumps to application.
After I remove it, it works fine because it is set in application like the above...
Thanks,
Christie