Hi,
as per your code you do in while loop following
1. SW start ADC conversion on both ADCs
2. waits for conversion complete
3. once first "dominant sample" is detected ADC results are starting to be saved into a buffers and steps 1-3 are repeated until buffers are full
4. then buffers content is compared with the ID of received frame
What is the result you got?
If you have ADC conversion time about 1us+some SW overhead and CAN bitrate at 50kbps (bit time 20us) you have quite big oversample ratio. It can be OK, but you have to properly interpret the result.
Also instead of SW start of ADC it should be better to use HW trigger, eg. using PBD and trigger ADC at given rate according to CAN bit time.
Another note; even if you will sample bus signals properly you will need to remove possible stuff bits which exists on CAN bus and which are added/removed by FlexCAN module.
BR, Petr