I am using MPC5748G Dev kit to read CAN messages from the OBD port of my car , Currently I am not able to receive any messages in the board , because of baud rate mismatch and also configured Rx ID is only one in the example code.748g
my questions are ;
1. How to change the baud rate ?
2. how to configure multiple read messages , if I have many Rx messages to read how to configure all of them.
Thanks in advance
bits BUF0to31 in IFLAG register are set by hardware. When data are correctly received by message buffer, appropriate bit in IFLAG register is set.
Please check the example code below:
I checked mpc5748g devkit and it has only one CAN transceiver. If you want to do some CAN communication, I recommend to connect boards together.
about baud rate, please see the article below. It shows, how to calculate correct values for required bit rate.
about your second question, you simply configure every message buffer you would like to use. In the code above, CAN0 message buffer 4 is configured. You can configure every MB is the same way. If you want to receive every possible ID, use ID 0 for MB configuration (for example CAN_0.MB.ID.B.ID_STD = 0x0;)
Thank you very much for the reply. it is really helpful for the understanding, However I have some more questions to you.
Boud rate calculation, is very clear. but regarding the Message Buffer selection i have some issues as below.
As you said I just have to use the MB[x] with the required ID or by making it as zero we can receive any possible Rx message
for example If I have to receive the Message ID 0x6FC. I just have to modify as CAN_0.MB.ID.B.ID_STD = 0x6FC;
However I have a device which is sending 0x6FC , still I am not able to receive the Messages . If I debug I have the problem at the below
While loop (), execution is getting into infinite loop, since condition is never false.
Bit BUF4TO1I is basically to understand if this is a Interrupt or for reserved.
this particular bit is again dependent on the CAN_MCR[RFEN] .
Now I have a concerns .
who is responsible for making the BUF0to31 bits to Set (logic 1), if i want to use all the buffers from 0 to 31.?
thank you very much b55689 again for your Kind support.