Tip/semi-bug for setting CAN Acceptance Filter using CMSIS function "CAN_SetupAFLUT"

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by wlamers on Tue Nov 06 08:58:47 MST 2012
Dear all,

While debugging a rather large program I discoverd an annoying semi-bug. This can probably not be called a real bug since it depends on the usage case. In my case the program resulted in a hard-fault. This is tested on a LPC1769 and a LPC1778 both using the newest CMSIS driver's found here on LPCware.

If one is using the CMSIS function "CAN_SetupAFLUT" to set the CAN acceptance filter values in RAM and you want to change the contents of the acceptance filter structure (the one that is passed to the argument pointer of the function) during run time (e.g. by reading in a new file from an SD card). Then you should be aware that the "CAN_SetupAFLUT" function is changing the value's of the structure pointers. This is implemented with de-referencing the pointer using "AFSection->SFF_Sec = ..." etc.

You should manually restore the pointer value's (memory adresses) and also the counter variables "CANAF_std_cnt" etc.

Just that you know... Hopefully this is helpfull to somebody.

Best regards,