Other Parts Discussed in Thread: HALCOGEN
For the content in the yellow box, what means can be changed according to customer needs?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
For the content in the yellow box, what means can be changed according to customer needs?
Hi xiaofu,
Please refer below thread:
--
Thanks & Regards,
Jagadish.
Dear Jagadish, Thanks for your reply.
I have another question. could you pls suggest how to modify CAN BUS error's threshold?
Because, TMS570 could not trigger BUSOFF. we want to modify threshold to try it.
and other suggestion is also welcome.
Hi Frank,
I have another question. could you pls suggest how to modify CAN BUS error's threshold?
Because, TMS570 could not trigger BUSOFF. we want to modify threshold to try it.
There won't be any register to adjust the threshold level for errors.
As per the TRM the Bus-Off will occur due to the massive occurrence of CAN bus errors.
--
Thanks & Regards,
Jagadish.
Thanks Jagadish,
Yes, Massive occurrence of CAN bus errors will lead to Bus-off.
Now,we met a problem. In CAN Bus, there are many error counter, such as 32Bytesx8x2, while my system only caputued 32Bytesx8x1.
So,CAN Bus error and CAN Bus off times mismath with CAN Bus really occurrence.
and could you pls suggest how to check this abnormal?
and how to get the CAN Bus error times in my TMS570 system. is there API for it?
or other program guide for this debug?
Thanks a lot for your advice.
Hi Frank,
Basically the CAN bit period can be subdivided into four time segments. Each time segment consists of a number of Time Quanta (tq). The Time Quanta is the smallest time unit for all configuration values. The Time Quanta (tq) is determined by baud-rate and BRP.
Time Quanta tq: (BRP+1)/CAN_CLK
Number of Quanta: CAN_CLK / [Baud-rate * (BRP+1)]
There are several options for number of time quanta and length of segments (Tseg1, Tseg2) for a given baudrate. The HALCoGen only gives one option, that might not be the best choice for your application.
The number of segments are not changeable from the HAL GUI, but you can change them in the HAL generated source file: can.c
There are two error counters: TX error counter and RX error counter. Bus Off occurs when the transmit error count raises above 255. Whenever a node fails to transmit a frame, it increases the error counter and when the counter increases beyond 255, the node gets in bus-off state and can not further participate on the bus.
Thanks for kindly reply.I can know these basic knowledge now.
But where can get this programm guide for modifying like "the number of segments".
Even I have the source code of can.c and can.h. but I have no register datasheet or programm guide.
And last question is IF the error counter mismath with the bus, how can I do next?
Thanks a lot.
You can program the time segments to CAN timing register:
canREG1->BTR &= 0xFFFF003F;
canREG1->BTR |= (TSeg2 << 12U) | (TSeg1 << 8U) | (SJW << 6U);
The threshold of transmit error to trigger CAN Bus-Off can not be changed.