I am porting the CAN diagnostic communication protocol stack for mpc56xx to the S32K3 platform. I am currently modifying the CAN driver layer. I am not using the official CAN driver, but modifying the original driver.
I initialized can2 and can3. Shorted them to form a CAN network. CAN2 sends 0x262 and receives 0x263, CAN3 sends 0x263 and receives 0x262. The terminal resistors are also configured correctly. The problem is that after CAN2 and CAN3 successfully sent a message, both triggered a noncorrectable error and entered freeze mode.
The MCR[MAXMB]for can2 and can3 are 0x3f and 0x1f respectively. I did not initialize all MB of RAM space, but only MAXMB amount of RAM.
When the error happened:
for can2: RERRAR[ERRADDR]=0X0548; RERRAR[SAID]=0X1; RERRAR[NCE]=0X1; ERRSR[FANCEIF] = 1
for can3: RERRAR[ERRADDR]=0X02C8; RERRAR[SAID]=0X1; RERRAR[NCE]=0X1; ERRSR[FANCEIF] = 1
Some other information:
a. if can2 and can3 are not short-circuited, messages can be sent and received normally.
b. If not only initialize maxmb of RAM space, but all MB ram space, the noncorrectable error will not happen, send and receive normally. (about this, I guess the flexcan accessed the uninitialized RAM space, but maxmb has limited the access location of flexcan. I don't know why this happened.)
If any additional information is needed please let me know, this problem has been bothering me for over a week now.