Hi All- I am using the freedom KL46Z board. When I run any code after copying (downloading) the hex file to the FRDM-KL46Z E: drive (as it appears on my PC), the code appears to only work for a short duration: e.g. I had two successive lines to print a char to a terminal - It only prints the first, each time I reset, it just prints the first char. I thought it was my uart routine, so I used the code below just to light an led -
Bit1_SetVal(); switches the led off and Bit1_ClrVal(); switches it on.
If I do:
Bit1_SetVal();
Bit1_ClrVal();
then the led lights, but if I do say...
Bit1_SetVal();
Bit1_SetVal();
Bit1_ClrVal();
then it doesn't light. It is as though the extra delay caused by the extra line of code has stopped the main code.
It seems to be a watchdog type issue, but I have included the default line: PE_low_level_init();
Here is the code fragment for the led routine:
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
Bit1_SetVal();
Bit1_SetVal(); // If I comment this out the led lights
Bit1_ClrVal();
for(;;)
{
}
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
regards
Russell
Hi Russel,
Please check whether you had disabled the watchdog timer or not in the Component Inspector like the Fig 1 shows.
Fig 1
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
HI Ping
(Sorry I confused you with Mark)
I can't enter debug mode (only drag and drop to run)
How does the component inspector know if the watchdog is enabled?
It can't be reading my board - so is this just at software level?
Ok - I got my board working but now when I enable interrupts in the uart property the routine prints one character and then stops - an interrupt problem maybe??
EDIT: Ok, if I put a delay between sending characters, then it sends individual characters - but only if interrupts are disabled (I had enabled interrupts to use the sendblock command later)
Hi Russell,
I'm glad to hear that your board can work well.
However about your new issue of the UART send, I'm not very clear with it yet now and I was wondering if you can clarify it again.
I'm looking forward to your reply.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Ping, the problem is perhaps my understanding of using asyncroserial , Erich has pointed me to some examples so I'll try those.
Hi, Russel
Have you solved your issue?
please let us know
Regards
Patricia
Hello - sorry for my long time-no reply.
I have just returned, so I will try the suggestions and see how it all goes.
thank you for asking
Russell
Hi Mark - mmm right you are: I see this:
But my init code should have disabled it in PE_low_level_init(); ?
Hi jeremyzhou
Thanks I would like to try your suggestion - forgive my ignorance, but how exactly do I use the binary ?
Am in codewarrior
Russell
Has the watchdog been enabled with a timeout of a few seconds which could explain it resetting?
Load a binary from here to check your board: µTasker FRDM-KL46Z support
Regards
Mark
Kinetis: µTasker Kinetis support
KL46: µTasker FRDM-KL46Z support / µTasker Kinetis TWR-KL46Z48M support
For the complete "out-of-the-box" Kinetis experience and faster time to market
Hi Mark
Thanks, I would like to try your suggestion - forgive my ignorance, but how exactly do I use the binary ?
Am in codewarrior
Russell
Binary files can be loaded via drag-and-drop to the FRDM-KL46's USB-MSD OpenSDA disk.
They can also be loaded using CodeWarrior's Flashing Utility.
The functionality of the binary is described at the link - when it runs it will display something in the SLCD, flash an LED and communicate via USB/UART.
Regards
Mark
Kinetis: µTasker Kinetis support
KL46: µTasker FRDM-KL46Z support / µTasker Kinetis TWR-KL46Z48M support
For the complete "out-of-the-box" Kinetis experience and faster time to market
HI Mark, yes it works as you say - but so does the kinetis demos. My problem is any code that I write and drap/drop.
I also can't seem to get into debug mode. (Do I need other drivers for this?)