Questions on using USB DFU Bootloader for K60 uC

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Questions on using USB DFU Bootloader for K60 uC

5,073 次查看
kaitav
Contributor III

Hi everyone,

This is my first post in freescale community.

We have prepared a prototype board for evaluating MK60FN1M0VLQ15 and are trying to work on programming it via USB using the DFU bootloader application note AN4370SW and its software. However, we are facing some issues being new to CodeWarrior and processor expert environment.

Ok, so I have managed to create a project and able to compile the K60 code from location: AN4370SW\Source\Device\app\dfu_bootloader\cw10\kinetis_k60

Now, as per application note it is required to modify the linker file for locating application at a specific memory and this requires me to disable the linker file generation in the project and then modify the file. So I open component inspector view to go to build options, but unfortunately it shows a blank view. After looking into it, I came to know that the project is not created using processor expert and hence I am not getting these options.

Following are my main queries:

1) My basic requirement is to prepare USB bootloader that works on K60. How do I adapt the given code in CodeWarrior environment so that I can proceed as per application note? What am I missing?

2) I looked into the forums and found a way to convert the code to PE using "Enable Processor Expert for the existing code" and got 2 errors on compiling:

mingw32-make: *** [Generated_Code/Cpu_c.obj] Error 1 Kinetis_MK60N512VMD100_dfu_bootloader C/C++ Problem

mingw32-make: *** [Generated_Code/Vectors_c.obj] Error 1 Kinetis_MK60N512VMD100_dfu_bootloader C/C++ Problem

Could anyone please give me some information on these errors and the reason behind it? I know that this PE conversion may not be full proof, but I was just trying to see if it works. Oh, and after I converted to PE, I was able to see component inspector view and build options.

Sorry if my explanation is unclear, I am not familiar with these tools and also not much into software in general. I checked a few related topics on forum but they did not help me much.

Please let me know if more details are required.

Thanks,

Kaitav

标签 (2)
0 项奖励
回复
19 回复数

3,485 次查看
kaitav
Contributor III

Hello,

I am unable to use USB MSD Device bootloader with K60 new tower kit. Could you please give me some hints as to what modifications will have to be done to make it run?

I suspect that there should be some changes required in the clock/frequency settings, the K60 header file, etc. but I am not able to get my head around it as software is not my main domain. So some insight would be helpful.

Thanks,

Kaitav

0 项奖励
回复

3,485 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Kaitav,

Yes, you are right. The current is for TWR-K60N512, it is Kinetis 100MHz part, not the one that you are using, but you may refer to Kinetis_120MHZ_SC for help, there are drivers for 120MHz/150MHz part , you may download it from Kinetis 120MHz bare metal sample code .

Hope that helps,

B.R

Kan

0 项奖励
回复

3,485 次查看
kaitav
Contributor III

Hi Kan,

Sorry, I was busy lately with other tasks and hence could not perform this task and get back to you.

Today, I started again with USB MSD Device Bootloader with the New K60 Tower kit. I downloaded the drivers from the link you gave earlier. I tried to look into it, but unfortunately I am not able to understand what should I do to run the bootloader on the new tower kit.

Could you please guide me a little as to what drivers should I modify and how do I do it? Some direction would be helpful.

Thank you,

Kaitav

0 项奖励
回复

3,485 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Kaitav,

The USB MSD Device Bootloader contains a "main_kinetis.c" file which is used to  initialize the system, and if you want to use this bootloader on the new k60 tower, you have to modify the Init_Sys() in it, especially pll_init(), and you may refer to https://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS_120MHZ_SC&appType=file1&lo... for more details on the pll init code.

Hope that helps,

B.R

Kan

0 项奖励
回复

3,485 次查看
kaitav
Contributor III

Hi Kan,

Thank you again for your advice. I am trying that now.

Meanwhile, I want to ask if there is any need to modify anything related to Flash driver or USB related code in the bootloader itself?

Regards,

Kaitav

0 项奖励
回复

3,485 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Kaitav,

There is no big difference between the new k60 and k60n512 on flash and USB module, so I think they are not needed to be modified. For more details , you may refer to http://cache.freescale.com/files/32bit/doc/app_note/AN4445.pdf?fsrch=1&sr=1 for help.

Hope that helps,

B.R

Kan

0 项奖励
回复

3,485 次查看
kaitav
Contributor III

Hi Kan,

Hmmm, I see.

Ok, I will go through that document if required. :smileyhappy:

Regards,

Kaitav

0 项奖励
回复

3,485 次查看
kaitav
Contributor III

Hi Kan,

Thanks again for extending your support. I have downloaded the zip file and will get back to you after trying it.

Thanks,

Kaitav

0 项奖励
回复

3,485 次查看
kaitav
Contributor III

Update: I am now able to use the DFU bootloader code with K60N512 (old) tower kit. I just used the software provided along with the application note, compiled it and programmed the board as mentioned in the application note. I think it was a gap in my understanding. I am keeping existing code->PE conversion aside for now.

However, I am not able to run it in K60FN1M0 (new) tower kit. The board does not boot into DFU mode and hence not able to follow steps I followed previously for old kit. I followed the same steps except that I used the K60FN1M0 flash configuration .xml file when programming the bootloader which is necessary. I even modified the bootloader.h as required.

#define MIN_RAM1_ADDRESS        0x1FFF0000

#define MAX_RAM1_ADDRESS        0x20010000

#define MIN_FLASH1_ADDRESS      0x00000000

#define MAX_FLASH1_ADDRESS      0x000FFFFE // 1 MB flash

#define IMAGE_ADDR              ((uint_32_ptr)0xA000)

#define ERASE_SECTOR_SIZE       0x800  /* 2K bytes*/

#define FIRMWARE_SIZE_ADD       0x000FFFFE

Also could anyone please tell what FIRMWARE_SIZE_ADD exactly is? I took the existing example and changed it accordingly  to match MAX_FLASH1_ADDRESS.

Any help would be highly appreciated.

Thanks,

Kaitav

0 项奖励
回复

3,485 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Kaitav,


FIRMWARE_SIZE_ADD is where the size information of the firmware(the downloaded application code) locates, the DFU boot loader will store this info in this position after downloading. The example for K60N512 can not work with K60FN1M0 because they have different silicon revision, but you may refer to the DFU bootloader for K70 for your K60FN1M0 (new) tower kit, and you may find it in "AN4370SW\Source\Device\app\dfu_bootloader\cw10\kinetis_k70".


Please kindly let me know if the problem is still there.


B.R

Kan

3,485 次查看
kaitav
Contributor III

Hi Kan,

Thanks for the answer.

I am not sure if I understood FIRMWARE_SIZE_ADD exactly so let me ask it again with reference to your explanation. Does it mean that it is the address where bootloader stores the number/amount of firmware size? i.e. for example if firmware size is 100KB it stores the hex value of 100KB in that address. Is it like that?

Oh, I see. Well, I would not have been able to figure it out myself then. I will check with the K70 bootloader and let you know if that works or not.

Edit: Is there any such catch for USB Mass Storage Device bootloader too? Because I also want that to run.

Thanks again.

Kaitav

0 项奖励
回复

3,485 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Kaitav,

Yes, your understanding is correct. and for USB Mass Storage Device bootloader, please kindly refer to http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4379.pdf?fsrch=1&WT_TYPE=Applicatio... for details.

Hope that helps,

B.R

Kan

0 项奖励
回复

3,485 次查看
kaitav
Contributor III

Hello Kan,

I tried using K70 bootloader code with the new tower kit but I am stuck. I compiled the code in K70 folder and downloaded the generated "kinetis_k70.afx" file using the K60FN1M0 flash configuration file in the flash programmer utility. To my surprise, the DFU demo application exe could recognize the attached tower kit (which it earlier wasn't), but when I clicked "Enter DFU mode" the application gets stuck and "Status" at the bottom of its window shows "Detaching device...".

I am trying to figure out myself too, but thought to ask if you know what might be causing it. What all things should I change when using K70 bootloader code with K60 new tower kit?

Thanks,

Kaitav

0 项奖励
回复

3,485 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Kaitav,

Do you mean you have installed the inf file "DFU_Device_Runtime.inf" successfully but failed to install "DFU_Device.inf" as Window didn't ask for driver installation again after you clicked "Enter DFU mode"? Which OS is running on your PC, Win7 or WinXP? Actually it looks like a driver problem, and I have met similar problem before, I have installed the DFU driver for AN4370SW , and run the demo successfully, but after that I also installed the DFU driver for USB stack ver 4.0.3, and seems system messed them up, and the same issue happened after that. When I run the demo with a fresh PC, the problem never happen.

Hope that helps,

B.R

Kan

3,485 次查看
kaitav
Contributor III

Hi Kan,

Thanks again for your support.

Yes, I think it is the same case. I mean earlier I used the old tower kit to run the DFU bootloader and as it was the first time I executed that on my PC, it asked me for the driver installation and stuff. Now, I already have the driver somewhere so it is not asking again. I am using Windows 7.

1) Were you using K70 CW10 project and without changing anything able to program the K60FN1M0 new tower kit? I mean you would have used K60 flash configuration file in the programmer utility.

2) Also, is there any way to remove the driver and start afresh with new tower kit on my PC itself?

I will try to check on a new PC meanwhile.

Thanks,

Kaitav

0 项奖励
回复

3,485 次查看
kaitav
Contributor III

Hi Kan,

Good news: I was just able to run the DFU on new K60 tower kit using K70 CW10 project, on a new PC. There indeed seems to be some issue with the driver as you mentioned but is there any fix available for it? How can I remove the previously installed driver?

What I did: Used the K70 DFU project>compiled it without any change>used K60FN1M0 flash configuration file during programming>connected my tower kit to new PC, installed drivers and downloaded a blinky file to the uC.

1) One problem, however, is that after programming the board with Blinky.hex (the project available with Keil/ARM for K60 New tower kit), LEDs do not glow. Any suggestions?

2) Also, is it possible for you to tell what the differences are when I build the K60 code and K70 code? You mentioned about silicon version, but is there some change in some .c or .h files worth looking at?

Now I am also focusing my attention on running MSD Device bootloader on new tower kit as that is the main thing we are looking to implement.

Thanks for your valuable time.

Kaitav

0 项奖励
回复

3,485 次查看
陈欣
Contributor III

Hi Kan_Li:

Where can I find the demo:

USB_MSD_DEVICE_BOOTLOADER

0 项奖励
回复

3,485 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi 陈欣,

Please kindly refer to http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4379SW.zip?fsrch=1&sr=1 for details.

Hope that helps,

B.R

Kan

0 项奖励
回复

3,485 次查看
陈欣
Contributor III

HI Kan_Li:

Thanks;

0 项奖励
回复