First call of setup assumes header was loaded and controller is still in freeze mode.
A second call of setup or a setFilter AFTER the setup() is called, a hard fault is occured because you're writing to the RXFGMASK outside of freeze mode.
I suggest you wrap entering and exiting freezemode around both setup() and setFilter() RXFGMASK sets to correct the hard fault condition
First call of setup assumes header was loaded and controller is still in freeze mode.
A second call of setup or a setFilter AFTER the setup() is called, a hard fault is occured because you're writing to the RXFGMASK outside of freeze mode.
I suggest you wrap entering and exiting freezemode around both setup() and setFilter() RXFGMASK sets to correct the hard fault condition