USB Bootloader

Discussion of the PSoC CY8C24x94 and other PSoC like USB parts from Cypress should be discussed here. This forum is limited to the discussion of USB portion of those parts. Other forums should still be used to discuss the non USB features of these parts.

Moderator: ericb

USB Bootloader

Postby graaja on Fri Jun 24, 2005 4:12 am

Hi All,

I have the first version of a working USB bootloader. I am attaching the files here. Following are the contents.

1. Bootloader Template project. Project on which bootloader based applications can be developed.
2. Example Bootloader project. This project implements the bootloader. The main application runs with USB as HID device. And when an enter bootloader command is received over the USB, the bootloader is entered. A small VB program to issue this enter bootloader command is also attached.
3. Driver setup. This is the driver for the USB bootloader. I have used the same driver provided by Matt for his Bulk Ping Example.
4. Bulk_Ping_Host_No_MFC. I have modified the project provided by Matt for the Bulk_Ping demo to implement the bootloader host. This program can read the hex file, and send the bootloader command and packets to the psoc to execute a bootload.
5. EnterBootloader. A VB project to make the example project to enter bootloader. This is to demonstrate the capability of the application to enter bootloader from the user code
6. Bootloader document. A draft document that describes the bootloader.

The shortfalls of the above project are:
1. I have not used a dedicated driver for the bootloader. So the bootloader will enumerate as Bulkping Example. But this can be modified as per requirements by user.
2. As I am not that good in VC++, the bootload host application is a very crude implementation.
Attachments
UsbBootloaderV10.zip
(793.26 KiB) Downloaded 1457 times
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby Alejandro on Wed Jun 29, 2005 2:00 am

Hi,

graaja wrote:1. I have not used a dedicated driver for the bootloader. So the bootloader will enumerate as Bulkping Example. But this can be modified as per requirements by user.


I am working in a project that involves CY8C24794 and I don't know very much about Windows programming nor VC++. The example of Bulk Ping is very useful, it seems really easy to communicate with the PSOC. But my question is: How can I modify the project to have a different enummeration name? Do I have to write a new dedicated driver (I don't know how to do it)? Can I just modify some things in AsyncPing.inf and change the name of the dll?

Thank you very much!
Alejandro
Newbie
Newbie
 
Posts: 2
Joined: Wed Jun 29, 2005 1:51 am

Postby graaja on Wed Jun 29, 2005 4:13 am

Hi Alejandro,

Yes. You can modify the bulkping.inf (I have used this as driver for bootloader, not the asyncping). Change the VID and PID at 2 places

[CMS]
%VID_PID.DeviceDesc%=BULKPING,USB\VID_04b4&PID_E001
VID_PID.Ids="USB\VID_04b4&PID_E001"

Replace 04b4 with your VID and E001 with your PID.

Also you can change the "Bulk Ping Example" string to change the way the computer reports the device.
VID_PID.DeviceDesc="Bulk Ping Example"

I think these modifications should be enough. You can keep the name of bulkping.sys as it is. Maybe someone more experienced on this subject can add their comments if I am wrong.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby Alejandro on Wed Jun 29, 2005 6:10 am

Thanks a lot. I will try it as soon as I have the Development Kit.
Alejandro
Newbie
Newbie
 
Posts: 2
Joined: Wed Jun 29, 2005 1:51 am

Postby graaja on Thu Jul 28, 2005 4:52 pm

An updated bootloader template. Code added to clear WDT regularly, if the user code had enabled WDT prior to entering bootloader.
Attachments
USB Bootloader_draft_3.pdf
(67.14 KiB) Downloaded 1029 times
usb_bootloader_template_1_1.zip
(89.66 KiB) Downloaded 886 times
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby graaja on Wed Jan 11, 2006 5:29 pm

Hi All,

Probably, this is a bit late to be posting this thread.

I just thought to make clear that the code posted in this topic is not an official version and users should use it at their own risk (I believe users are already aware of this :)).

Work is in progress at Cypress to finalize the bootloader.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby Boris on Wed Jul 12, 2006 8:21 am

Hi

I tried to use your Bootloader but not with HID but with a driver.
It doesn't work and the device is not responding. :(
Tne device is entering in Bootloader because the first 10 bytes packet is received and the device answer with the correct error code. The .hex file is open and read properly. But when it start to load the Code the device is not responding and reset.

Maybe you know something about this problem because i did not modify your code. :?:

Regards

Boris
Boris
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 13
Joined: Wed Jul 12, 2006 8:07 am

Postby Boris on Thu Jul 13, 2006 2:06 am

Hi ,

In fact the problem is when the bootloader call the flashwriteLite function in flashAPI.asm. The Store of the data is correct and when the program write the USB is deconnected so the device is not responding.

Please Help me!!!

Boris
Boris
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 13
Joined: Wed Jul 12, 2006 8:07 am

Postby graaja on Thu Jul 13, 2006 2:23 am

Hello Boris,

The bootloader is not a HID class device. It is a vendor specific class with 64 byte IN endpoint and 64 byte OUT endpoint. Did you try doing the bootload using the VC++ application which is found in the zip file that I had posted earlier?

Also, if you are using ICE-CUBE to emulate the bootloading, it will not work. The ICE takes about 2 seconds to write a single block of flash and during this time, the USB bus will get reset. If you are satisfied that the block write and the basic bootload functions are correct, try the process on a chip directly.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby Baka_boy on Mon Jul 17, 2006 10:40 pm

Hi guys, followed the simple steps from the app note. Created a clone project based on the template (1.1) provided. To test it I connected S1/S2 (USB eval board) to enter bootloader mode after all modules and interrupts are stopped/disabled. Seems to "work" (i.e. hear discon/re-connect beep from PC). Thing is I can't bootload it using the modified bulk_ping. The bulk_ping program can connect, parses the hex file correctly, but fails on the first read from device (i.e. device status). Anyone might know what I might be doing wrong? :D
Baka_boy
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 11
Joined: Mon Jul 17, 2006 10:06 am

Postby graaja on Mon Jul 17, 2006 11:23 pm

Are you using the debugger? The bootload will not work with the debugger. You will have to disconnect the debugger and then try the bootload process.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby Baka_boy on Tue Jul 18, 2006 1:31 am

Hi graaja,

No I'm using the mini-programmer provided with CY3214, I also have the ICE4k but I've never used it with the 24794. Please note that I also have this very weird problem with the original "bulk_ping" program. That the FIRST ping ALWAYS fails, unless i do the following code after the USB has finished enumeration.

Code: Select all
USBFS_LoadInEP(BULK_EP_IN, g_packet, BULK_PACKET_SIZE, USB_TOGGLE);


I haven't found/read any reason why I would need to do that, but it just works that way -__-'. I've also have tried on all of my 3214 evaluation boards (i have 2), and both operate the same way. I'm trying to modify the provided example at the moment so that i can test it with the bulk_ping programmer. The VB program says it enters bootload mode successfully.
Baka_boy
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 11
Joined: Mon Jul 17, 2006 10:06 am

Postby graaja on Tue Jul 18, 2006 2:54 am

Hello Baka,

In the usb bootloader, this initialization of the InEP with USB_TOGGLE flag is done. Also, the bootloader code is a working version which has been tested. I have done 3 more versions after 1_1, but they are for watchdog functionality etc. I am attaching the latest version of the bootloader template and the example project. Check if this works.
Attachments
UsbBootloaderVer14_081105.zip
(248.06 KiB) Downloaded 669 times
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby Baka_boy on Wed Jul 19, 2006 3:42 am

Okay, thanks for the help! I'll let you know if it works on my setup, got sidetracked a bit by some other project. :D
Baka_boy
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 11
Joined: Mon Jul 17, 2006 10:06 am

Postby graaja on Wed Jul 19, 2006 3:47 am

Yes. It should work with the bootloader utility as it is.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby AndyW on Wed Jul 19, 2006 6:39 am

I dont agree that the bootloader should necessarily fail when used with the debugger. There is no doubt that it does fail though. But if the issue was caused by a USB reset, why would this happen? The USB SIE should continue to NAK requests during this time and the host should not object.
A simple utility which copies the same block of data to sucessive blocks of flash (obviously not the same blocks which the code occupies) also fails with the debugger even if it does nothing related to USB. The failure always happens on the same block, but the block changes with the exact start block number. There is no doubt that there is a bug in flash writing with the cube. I posted a topic on the main forum about this.
My own bootloader works fine with the debugger if I disable the block count and simply write the same flash block repeatedly as a test. No USB reset occurs at all despite the entire process taking 30 seconds to complete.
I was intending to post a support request about this but have not had time to package up a test routine to attach. The ideal way to observe this behaviour is use the LCD display to display the incrementing block number.
Andy
AndyW
The Big Cheese
The Big Cheese
 
Posts: 180
Joined: Mon Jul 18, 2005 6:06 am
Location: London, UK

Postby graaja on Wed Jul 19, 2006 7:52 am

Hello Andy,

I had come across this problem when I had started working with the bootloader. This was discussed in the following thread.

viewtopic.php?t=952

It would be great if you can give some details of the bug you have found when you can find the time. That may help in identifying the exact cause of the problem.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Serial Boot loader

Postby saj on Wed Aug 30, 2006 2:26 pm

Is there a boot loader that can work over the serial port
Thanks
Looking for Controller boards?
www.microtrend-inc.com
User avatar
saj
Newbie
Newbie
 
Posts: 6
Joined: Sun Jun 18, 2006 7:31 am
Location: US

Re: Serial Boot loader

Postby graaja on Wed Aug 30, 2006 4:56 pm

saj wrote:Is there a boot loader that can work over the serial port
Thanks


There is an app note, AN2100 on this.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

USB Bootloader

Postby mschwarz on Thu Sep 28, 2006 4:24 am

Hello Raaja,

after fiddling a little bit with your project, I saw you used the USB libs twice. One for normal mode and one for the protected mode area. Ok, this costs roundabout 3kByte extra, but much worser the copied USB code is not up to date. For example in USB.asm (which normally is USBFS.asm) there is the 12MHz workaround and the other library improvements not implemented. Is there any possibility to avoid using the libs twice? As far as I can see only the memory location is important.

Or could we do somehing like a "lib copy routine", which takes the most recent versions and patches only the location which are really need to be tweaked?

cu, Mirko.
mschwarz
Newbie
Newbie
 
Posts: 5
Joined: Thu Sep 28, 2006 4:10 am

Next

Return to USB

Who is online

Users browsing this forum: No registered users and 0 guests