Can't set Base of Interrupt Vector Table register (BIV)

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

cross mob
User19424
Level 3
Level 3
First solution authored First like received
Hello.
I need to change the BIV during runtime. (For T297 using Tasking Compiler)
Now, BIV is a Core Spacial Function Register, so I know you can't just alter it and need to use __mtcr()
__mtcr() works for other registers such as SYSCON and PSW, but for some reason fails to work for BIV?

Here is my code and the assembly generated:

__mtcr(CPU_BIV, 0x80002000);

//[Assembly]
mov d15, #0x2000
addih d15, d15, #-0x8000
mtcr #0xFE20, d15
isync


For some reason, nothing changes:
Here is the registers just before the mtcr mnemonic is run:
4677.attach

And here it is just after isync is run:
4678.attach

For some reason only PC has changed (obviously) but not BIV 😞
Anyone know why this happens? Are BIV/BTV special and need a special way to change them?
Thank you and have a great week!
0 Likes
4 Replies
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
BIV and BTV are equal, there is no different way to change them. It seems that your SW don't call the code for changing the BIV or the BIV will be set to 0. The BTV will be set from your software (Reset value is 0xA0000100). Check in your software what is different.
0 Likes
User19424
Level 3
Level 3
First solution authored First like received
MoD wrote:
BIV and BTV are equal, there is no different way to change them. It seems that your SW don't call the code for changing the BIV or the BIV will be set to 0. The BTV will be set from your software (Reset value is 0xA0000100). Check in your software what is different.



Ok.
But what are the correct lines of code to change them?
I thought it is __mtcr but it doesn't seem to work

The assembly code I wrote does run I have checked, the issue is that it doesn't do anything:
4674.attach

BTV is not relevant to me in this specific case. I just need to somehow change BIV.
0 Likes
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
Some registers are endinit or safety endinit protected. Check out 5.8.8 Summary of CSFR Reset Values and Access Modes on page 321 of tc29xB_um_v1.3.pdf: the "CEx" in BTV means that the register is endinit protected, so you'll need to surround your MTCR with a clear/reset sequence. Something like this will work:

uint16 passwd = IfxScuWdt_getCpuWatchdogPassword();

IfxScuWdt_clearCpuEndinit(passwd);
__mtcr( CPU_BTV, 0x80002000 );
IfxScuWdt_setCpuEndinit(passwd);
0 Likes
User19424
Level 3
Level 3
First solution authored First like received
UC_wrangler wrote:
Some registers are endinit or safety endinit protected. Check out 5.8.8 Summary of CSFR Reset Values and Access Modes on page 321 of tc29xB_um_v1.3.pdf: the "CEx" in BTV means that the register is endinit protected, so you'll need to surround your MTCR with a clear/reset sequence. Something like this will work:

uint16 passwd = IfxScuWdt_getCpuWatchdogPassword();

IfxScuWdt_clearCpuEndinit(passwd);
__mtcr( CPU_BTV, 0x80002000 );
IfxScuWdt_setCpuEndinit(passwd);


Again to the rescue as always!
Thanks! It worked 🙂
0 Likes