2024-01-24 05:15 PM
hello~
I am using the spc58ec disp chip and want to continuously send CAN messages of different cycles.
Here is the code what i wrote:
////
void send_10ms(){
uint32_t rv;
CANTxFrame msg_10ms;
msh_10ms.ID = 0x11U;
msh_10ms.DLC = 8U;
msh_10ms.data32[0] = 0x1234U;
rv = can_lld_transmit(&CAND2, 0, &msg_10ms);
osalThreadDelayMilliseconds(10);
}
// and also have a similer fcuntion which send 100ms can message
////
I want them to send in different cycles.
The above can messages can only be sent in 100ms, how should they be modified?
Thank you~
Solved! Go to Solution.
2024-01-26 11:10 AM
Hi,
Every 10 messages a 10ms will clash in the same cycle of the 100ms message.
Try messages at 11ms and 100ms that should avoid they activate at the same cycle.
You can set two PITs (timers) to be woken up at the right time with an interrupt at the right moment.
Keep the interrupt handling routines short for best performance, e.g. change a state variable to record that the timer has expired.
For this and a lot of other common cases, you can access the examples under the AutoDevKit ecosystem
Best Regards,
AutoDevKit Team
2024-01-26 11:10 AM
Hi,
Every 10 messages a 10ms will clash in the same cycle of the 100ms message.
Try messages at 11ms and 100ms that should avoid they activate at the same cycle.
You can set two PITs (timers) to be woken up at the right time with an interrupt at the right moment.
Keep the interrupt handling routines short for best performance, e.g. change a state variable to record that the timer has expired.
For this and a lot of other common cases, you can access the examples under the AutoDevKit ecosystem
Best Regards,
AutoDevKit Team