Hello.
I downloaded the project "AN2295_Kinetis" KINETIS K 100MHz. I try to run on my board with MK60DN512 in debugger mode, and when it enters the while (1) to await receipt of characters from the serial port, the debugger gives the error:
ARM Processors, AN2295_Kinetis.afx (Suspend)
Thread [ID: 0x0] (Suspended: Signal 'Halt' received. Description: User halted thread)
1 0xE0B003E8 (0xE0B003E8) () 0xe0b003e8
The project is the original Freescale. I'm using in my board the UART3 to conect with PC.
I've also noticed that when I run the program win_hc08sprg.exe attempts to detect the target, nothing is coming out the computer's serial port.
Someone can help me?. Thanks in advance.
Greetings.
Fernando
Solved! Go to Solution.
Hello Ramon,
Please uncomment both defines, so in the file TWR_K60_cfg you should have:
# define KINETIS_MODEL K60_100MHz
# define KINETIS_K60_OM33Z
And change in bootloader_cfg.h the include to the correct one:
# Include "AN2295_TWR_K60_cfg.h"
//# include "AN2295_TWR_K60D100_cfg.h"
Now it should work.
Let us know if it solves your problem.
Regards,
Santiago
Hi Fernando,
The TWR-K60N512 board provides two serial port connection, one is on board OSBDM (USB CDC serial port UART5), the other one need to connect with TWR-SER board (UART3).
For the AN2295 is using UART3, which need to use serial port on TWR-SER board. And I check the latest AN2295 software, the baud rate is 9600.
Wish it helps.
Hi Hui_Ma.
Thanks for the reply
I'm testing with the Tower and the serial port UART3. I have win_hc08sprg.exe program, set to 9600 baud and marking Short TRIM. Now show me the following message: "The maximum attemps to try calibrate clocks reached. Baudrate Try again with diffrent settings.".
I tried with different baud setting, but some do not receive the ACK and other continuous showing the same message.
What can be the reason for this?
Regards.
Fernando
Hi Fernando,
What silicon revision are you using in your board?
K60N512 config supports two silicon revisions:
#define KINETIS_MODEL K60_100MHz
//#define KINETIS_K60_OM33Z
By default would be Rev1.x
And for silicon 2.x you should use K60D100.
There are some small differences but those differences make the project to work or not to work.
Luis
Hi Luis.
The silicon version is K60_OM33Z. And the revision is 1.0. I'm testing with TWR-K60N512.
Best regards.
Fernando
Hi,
Then, Have you changed the #define in the configuration file?
Luis
Hi Luis.
Yes, I have done the following:
/ / # define KINETIS_MODEL K60_100MHz
# define KINETIS_K60_OM33Z
But when I build the project generates 86 errors.
So what we've done is, in the file bootloader_cfg.h
/ / # Include "AN2295_TWR_K60_cfg.h"
# include "AN2295_TWR_K60D100_cfg.h"
The errors are solved. But when I run the program, it jumps to the function
Boot_ResetMCU()
I do not know what to do.
Fernando
Hello Ramon,
Please uncomment both defines, so in the file TWR_K60_cfg you should have:
# define KINETIS_MODEL K60_100MHz
# define KINETIS_K60_OM33Z
And change in bootloader_cfg.h the include to the correct one:
# Include "AN2295_TWR_K60_cfg.h"
//# include "AN2295_TWR_K60D100_cfg.h"
Now it should work.
Let us know if it solves your problem.
Regards,
Santiago
Thank you very much for your help.
That was it.
Had misunderstood the directions of Luis.
Thanks Luis and Santiago.
Best Regards
Fernando.
Hello again.
The tower is working properly.
However, I record it on my board and still not working.
The only difference between my board and the tower is that in my board, micro mask is 8N30D, and the frequency of this oscillator is 8 MHz instead of 50 MHz of the tower.
I think the problem may be in the BOOT_BUS_CLOCK value, but I do not know what value I enter.
Best Regards.
Fernando
Hello,
Try uncommenting the 0M33Z define.
Regards,
Santiago
El 18/10/2013, a las 09:09, "Fernando Ramon" <admin@community.freescale.com<mailto:admin@community.freescale.com>> escribió:
<https://community.freescale.com/>
<https://community.freescale.com/>
Problem running AN2295
reply from Fernando Ramon<https://community.freescale.com/people/feraro?et=watches.email.thread> in Kinetis Microcontrollers - View the full discussion<https://community.freescale.com/message/356558?et=watches.email.thread#356558>
Hello,
I try both TWR-K60N512 and TWR-K60D100M; with "Comment out #define KINETIS_K60_OM33Z", both only work for 9600bps,
with 14400 and 19200bps, it comes "The maximum attemps reached to try calibrate clocks. Try again with diffrent baudrate settings ".
with higher baud rate, it comes "received 0x00 (ignoring).".
The problem comes from the function: void SlaveFrequencyCalibration(void). The way of coding seems not good enough to handle with big range of baud rate,
diff = 0xFFFFFF - timeout_cnt - CALIB_PULSE_LENGTH;
TRIM_REG += diff >> 2; //6 =================>How this adjust the baud rate????
I also find the reading "timeout_cnt = SYST_CVR;" is quite close for 9600, 14400, 19200bps, around 16765500, is that right?
Regards
Sam
Hello,
this is little bit strange. Could I ask you to tell us the mask set of your K60 MCU (is better to use TWR-K60D100M), in case of this board (TWR-K60D100M), the configuration macro of 0M33Z must be removed ! And be sure that you are use right configuration file for this board.
The next thing what you have to check is what kind of synchronization pulse you are using - SHORT TRIM or not. As default for Kinetis MCU are example configuration files distributed with enabled SHORT TRIM feature , so be sure to check this option also in master application:
#define BOOTLOADER_SHORT_TRIM 1
I'm don't believe that in the clock calibration routine is any major bug, because the current algorithm is running at closed loop and 10 step should be really enough to get right clock from the internal clock source.
Best regards
Petr
Hi Petr,
I find the problem from the source code.
This version of AN2295 serial boot loader can only work for "BOOT_UART_BAUD_RATE", "AN2295_TWR_K60_cfg.h" define it 9600, so it can only work at 9600bps and fail on 14400, 19200bps.
Again, the problem is from "void SlaveFrequencyCalibration(void) ", here is my explanation:
PulseCnt = 0xFFFFFF - CalTimeout_Cnt ; (for example 9600bps ==> 23480; 14400bps ==>15634; 19200bps ==> 11728).
// compute difference to expected value
diff = 0xFFFFFF - CalTimeout_Cnt - CALIB_PULSE_LENGTH; (CALIB_PULSE_LENGTH = 23452 for 9600bps; if 9600bps, diff is close to zero, 14400 and 19200bps diff is big and the system can't adjust it).
My option, use "TRIM_REG += diff >> 2;" to trim the bus clock is not a good way to handle big range of baud rate.
We can use the "PulseCnt" value to adjust the "UART_BDH_REG()" and UART_BDL_REG()".
Regards
Sam
Hello,
I fully understand your issue, but I ask you if you double check the setting of SHORT TRIM option to be same as in embedded as in PC?
Because this is typical behaviour what are you describe for case that embedded is compiled with enabled SHORT TRIM option and in PC is not checked this option.
Please check it and let us know.
Petr
Hi Petr,
The "Short Trim" in PC is enabled, otherwise it doesn't work at the default baud rate.
Using "TRIM_REG += diff >> 2;" is suitable for fine tune, for example, the PC is at 9600bps, but the MCU is at 9500bps.
But for big range adjustment, for example, the PC is at 15200bps, but the MCU is at 9600bps, it is better to use "PulseCnt" value to adjust the "UART_BDH_REG()" and UART_BDL_REG()" directly.
Do you know how to adjust the "UART_BDH_REG()" and UART_BDL_REG()"?
Regards
Sam
Hello,
sorry, but I have to say that I'm disagree with your opinion, the bootloader is tested on plenty of boards and if you have correctly setup the baud rate on PC side and also on embedded side the adjust just the trim register is enough to final tune up the clock and synchronise it with the PC one.
Could I ask you to share your AN2295 project just to test it?
I really don't believe that this doesn't work, I'm so sorry.
We have to find the issue, with your board.
Best regards
Petr
Hi Petr,
The Freescale TOWER board has been used for several project for prototype, the hardware should be fine.
I download this bootloader to our working prototype board, it get this problem:
Wed Feb 19, 2014 17:49:10: Warning: Target inconsistency detected at Memory address 0x00000000
Wed Feb 19, 2014 17:49:10: Warning: Target inconsistency detected at Memory address 0x00000040
Wed Feb 19, 2014 17:49:10: Warning: Target inconsistency detected at Memory address 0x00000410
Wed Feb 19, 2014 17:49:11: Warning: There were warnings during download, see Log Window
Wed Feb 19, 2014 17:49:11: Loaded debugee: E:\work\K60Bootloader\AN2295SW\an2295sw\src\Kinetis\IAR_6_4\Kinetis K Debug\Exe\AN2295_Kinetis.out
I download the the bootloader from Freescale website, here is the bootloader.c version details:
**************************************************************************//*!
*
* @file bootloader.c
*
* @author b01119
*
* @version 0.0.32.0
*
* @date May-7-2013
*
* @brief Bootloader state machine file
*******************************************************************************
Is this the right version?
Would you please send me the web link for the right version of source code? I can download again to check the version.
Regards
Sam
Hi,
try this package, This one I'm preparing for release (maybe there could be some new bugs, be patient ).
This is unofficial version with some bug fixes (not in clock tuning algorithm).
Also there is prepared configuration file for both boards and both a fully tested.
The file is renamed ZIP file.
Best regards
Petr
Hi Santiago.
This define is uncommented. I did to make it work in the tower.
Best Regards
Fernando.
Sorry,
I meant "Comment it". This define fixes the bus clock, and makes it work with the 0M33Z mask. For your mask, you should comment it.
Regards
Santiago
El 18/10/2013, a las 09:47, "Fernando Ramon" <admin@community.freescale.com<mailto:admin@community.freescale.com>> escribió:
<https://community.freescale.com/>
<https://community.freescale.com/>
Problem running AN2295
reply from Fernando Ramon<https://community.freescale.com/people/feraro?et=watches.email.thread> in Kinetis Microcontrollers - View the full discussion<https://community.freescale.com/message/356564?et=watches.email.thread#356564>