I am trying to initiate a Timer (Timer 0) interrupt on the rising edge of a pulse.
The timer is in the Timer mode so as to count the clocks between the rising edges.
Following is my initialization code
Solved! Go to Solution.
Ok so I fixed the "unable to program" issue and the original issue. Let run down the steps I took for each.
So for the "unable to program" issue. After a lot of googling I found https://community.nxp.com/thread/389040 and this https://community.nxp.com/thread/389112
The key line to look for was the:
Wire Ack Fault
in the console window.
So I did the ISP reset debug by holding down the ISP reset push button on my board, and then clicking the GUI Flash tool. Pressing run erased the chip successfully. Once done I released the ISP Reset button.
Once I regained control of the chip, I saw the sample for match interrupt and I realized that they left the first element blank so I recalculated the index of the capture 1 and rewrote this line to:
ctimer_callback_t g_ctimer_callback[] = {NULL, NULL, NULL, NULL, NULL, NULL, ctimer_capture_callback, NULL};
The callback is now at the 6 index position (when starting from 0). This fixed the problem for me.
Ok so I fixed the "unable to program" issue and the original issue. Let run down the steps I took for each.
So for the "unable to program" issue. After a lot of googling I found https://community.nxp.com/thread/389040 and this https://community.nxp.com/thread/389112
The key line to look for was the:
Wire Ack Fault
in the console window.
So I did the ISP reset debug by holding down the ISP reset push button on my board, and then clicking the GUI Flash tool. Pressing run erased the chip successfully. Once done I released the ISP Reset button.
Once I regained control of the chip, I saw the sample for match interrupt and I realized that they left the first element blank so I recalculated the index of the capture 1 and rewrote this line to:
ctimer_callback_t g_ctimer_callback[] = {NULL, NULL, NULL, NULL, NULL, NULL, ctimer_capture_callback, NULL};
The callback is now at the 6 index position (when starting from 0). This fixed the problem for me.
Hi Safi,
I'm glad you were able to resolve both issues. If you have any other questions please dont hesitate to ask.
Best Regards,
Sabina
Thanks! will do!
Hi Safi,
I've been trying with different combinations to see which do work and which don't. So to answer the following question:
So Single Callback will always be at the "0" index position of the s_ctimerCallback.
That is correct if you state a single callback, you should put your callback in position 0. However if you use the single callback I would recommend to leave it like this to reduce errors ctimer_callback_t g_ctimer_callback[] = {ctimer_capture_callback};
or you can also state a Multiple Callback and leave it how you have it originally since the order you have it is correct as per the manual for capture channel 1.
So far I've not been able to replicate the behavior you are experincing.
Is it possible for you to attach your project? This way I can see excatly what you are seeing and I can better assist you.
Also note that LPCOpen and the SDK are completly different, so I wouldn't recommend to compare the two.
Thank you,
Sabina
I think by chip is busted. Now I programmed the board (no modifications to the code) and now the chip wont respond. I tried erasing the flash and I get this.
I can't over an open forum, even though it's a fairly basic code.
Please email me at safiullah(dot)hussaini(at)gmail(dot)com and I can attach it in reply. Or if you have any alternative mechanism for sharing, please let me know.
Regards,
Safi
Thanks in advance!
Hello Safiullah,
So far I've noticed that your RegisterCallback is stating kCTIMER_SingleCallback. This is when you only have one callback for the timer, but in your array you have {NULL, NULL, NULL, NULL, NULL, ctimer_capture_callback, NULL, NULL}; This means that there are multiple callbacks available for your timer, regardless that the rest are set as NULL.
Can you please try to change your RegisterCallback to kCTIMER_MultipleCallback and check if your breakpoint works.
Also can you please let me know the microcontroller that you are working with in case you have further questions.
Let me know your results,
Sabina
Hi Sabrina,
I also notice that the bit in the IABR0 (NVIC->IABR[0]) bit 10 does not go high, however the CR1 (CTIMER0->CR[1]) seems to get loaded at the positive edge.
I checked by varying the pulse width of the input pulse on CT_INP3/P1_26, and the CR1 value changes correspondingly.
This is very weird.
Regards,
Safi
Sorry, in my excitement I believe I forgot to mention the chip. I am using the LPC55S69 on the EVK.
So Single Callback will always be at the "0" index position of the s_ctimerCallback.
If I intend to use the single callback for capture, how would that work? Similar to LPCOpen?
But to check, I also placed a breakpoint at the start of CTIMER_GenericIRQHandler() as well. I think it too is not being invoked.
And please call me Safi.
Regards,
Safi