Timing issue and how to debugging time issue?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
leekings
Level 3
Level 3
50 sign-ins 25 replies posted 25 sign-ins

 

Hello.

I'm using TC367 Lite Kit and testing "MCMCAN_FD_1_KIT_TC375_LK" sample code.

When i try to use this samplecode , flash error was happen. So i Opend "STM_Interrupt_1_KIT_TC367_TFT" and copy&paste from 375 MCMCAN to 367 STM Interrupt.

 

1. How to change MCU setting from 375 to 367 in Development Studio?

2.  Original 375 MCMCAN sample code is loop-back mode sample, and it send 4 CAN MSG 1time and verify transmission status.

i do some modification it. i moved  sending CAN MSG function "transmitCanMessage()" to while loop. so sending CAN MSG is refeated.

in the original sampel code, verifyCanMessage() function returns g_status as 0 when Transmission and receiving is successfully done.
but when they are refeated in while loop,  g_status is returned as 4(Tx, Rx data is not matched)

when i debugging this step by step, there is no problem(g_status  is 0), but when i run it, there is problem Tx, Rx process.(g_status is 4)(i set LED driving function to check g_status  value)

so i added 1ms delay between transmitCanMessage() and it wrok as i intended

here is my question. 

 2-1 ) why this difference happen when i insert delay or not?
(i think it's timing problem)

2-2) i want to see Tx,RX buffer's value when g_status  is changed to 4. is there any function to monitoring the moment g_status set as 4 in development stdio?
(This is similar function to  triggering function in oscilloscope)

 

i added my sample code and please help me

 

thank you.

 

0 Likes
1 Solution
TBencher
Level 6
Level 6
25 solutions authored 25 likes received 5 questions asked

Hi,

the best way to move from one MCU to another is of course to setup a new project with related controller and copy the code as you did into it. You should further look whether given infrastructure matches your needs. Regarding your example you should go ahead and try to run it like in the original example code first. If this is running, you should not have any timing issues by default. Transmitting CAN messages in a while loop without proving pending status right there seems to be not really handy as well. Try using IfxCan_Status_notSentBusy() , or just wait of your first (send) interrupt (you have two interrupts defined in that example code, one for successful transmission and one for successful reception) to come and then send again, maybe that helps. 

Best regards,

TBencher

View solution in original post

0 Likes
3 Replies
TBencher
Level 6
Level 6
25 solutions authored 25 likes received 5 questions asked

Hi,

the best way to move from one MCU to another is of course to setup a new project with related controller and copy the code as you did into it. You should further look whether given infrastructure matches your needs. Regarding your example you should go ahead and try to run it like in the original example code first. If this is running, you should not have any timing issues by default. Transmitting CAN messages in a while loop without proving pending status right there seems to be not really handy as well. Try using IfxCan_Status_notSentBusy() , or just wait of your first (send) interrupt (you have two interrupts defined in that example code, one for successful transmission and one for successful reception) to come and then send again, maybe that helps. 

Best regards,

TBencher

0 Likes

thank you for your replying!

 

i moved verification() function to CAN receive ISR. and it work very well.

thank you very much for you help!

0 Likes
TBencher
Level 6
Level 6
25 solutions authored 25 likes received 5 questions asked

Hi,

regarding debug just connect your CAN-Node to a physical output and measure your packets with a protocol-analyzer. To see directly what is inside the TX and RX buffer during runtime you would just need to go into your reception interrupt, place a conditional statement on inequality of TX and RX and set the breakpoint. 

Best regards,

TBencher

0 Likes