I am new to CAN. I am having few doubts regarding CAN drivers. Please help me regarding this.The questions related here are based on the can.zip provided by Mr.David.
PLease refer can.zip for below questions.
1. can you explain the below structure how you got the values.
FileName :- can_init.c
can_SpeedParam_t can_SpeedParam[] = {
{125000, 15, 16, 3, 8, 4, 2, 0, 1},
{250000, 7, 16, 3, 8, 4, 2, 0, 1},
{500000, 3, 16, 8, 5, 2, 2, 0, 1},
{800000, 3, 10, 4, 3, 2, 2, 0, 1},
{1000000, 3, 8, 2, 3, 2, 2, 0, 1}
2.In Function void can_flexcan_init(void)
unsigned long *mbuf0 = (unsigned long *) (0x00000000+0x0220);
In above line how *mbuf0 is pointing to 0x00000220 address ? Is there any requirement or from where 0x0220 value got ?
3.*mbuf0 = (unsigned long) can_Rx;
In above line Can_Rx is a interrupt which returns nothing i.e void then why is type casted to (unsigned long) can we call the interrupt like that ? can you please explain ?
4.MCF5282_INTC1_ICR08 = MCF5282_INTC_ICR_IL(5) | MCF5282_INTC_ICR_IP(2); // MBUF0
In the above line how the Interrupt flag is setting ? what is MCF5282_INTC_ICR_IL and MCF5282_INTC_ICR_IP stands for ? those are #defines value.
can you explain the above line(point 4) please.
5. In one file under fat folder (FLEXCAN_test) there one line says that
set s-clock to 500kHz. i.e MCF5282_FLEXCAN_PRESDIV = 0x83 can you explain how it is set to 500kHz.I have read the bit timming reuirements but not understood properely. As per formulae to find
s-clock = fsys/2(PRESDIV+1), As per the formulae I am not getting 500kHz.Help me in this regards.
Awaiitng for your positive reply.
Regards,
krishna