Hi,
as I narrowed the previous problem from my last thread, I think it makes sense to start a new topic.
I'm using Keil and a RM46L852. I try to initialize message box 1 via the IF1 register using the following code (after setting the init bit in the CTL register):
canREG2->IF1MSK = 0xDFFC0000U; // 110|11111111111|000000000000000000 (MXtd = 1, MDir = 1, Msk = 7FFh)
canREG2->IF1ARB = (uint32)0x80000000U | (((uint32)15U) << 18U); // 100|00000001111|000000000000000000 (MsgVal = 1, ID = 15)
canREG2->IF1MCTL = 0x00001080U | (uint32)8U; // 100001000|1000 (UMask = 1, EoB = 1, DLC = 8)
canREG2->IF1CMD = (uint8) 0xF8U; // 11111000 (WR/RD = 1, Mask = 1, Arb = 1, Control = 1, ClrIntPnd = 1)
canREG2->IF1NO = 1U; // START COPY PROCESS: 001 (Message Number = 1)
while ((canREG2->IF1STAT & 0x80U) == 0x80U) {} // WAIT TILL IF1 IS READY
After this I expect the message box 1 to be configured and therefore check the MsgVal value (should be 1 as set in IF1ARB):
if(canREG2->MSGVALx[0] == 0) return false; // CHECK IF FIRST MESSAGE BOXES ARE VALID
This will always return false, hence I suspect that IF1 is not writing the message box configuration into the message RAM.
I was suspecting that maybe Keil is somehow putting the RM46 into debug mode so that the IF1/2 registers are not working anymore. Or that the RM46 is in a certain safety mode where the IF1/2 registers are not working.
Many thanks in advance,
Timm