AN3927 - MSD Bootloader fails when Re-enumerate

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AN3927 - MSD Bootloader fails when Re-enumerate

1,604 Views
leesp
Contributor I

I am using MC9S08JM32/CodeWarrior for Microcontroller v6.3, and trying out the mass storage device (MSD) bootloader (AN3927).

 

I manage to run the bootloader program (re-flashing of the ROM code). But when the device re-enumerate itself, most of the time in the Windows XP Device Manager, the device is shown as a "USB Mass Storage Device" but with a yellow exclamation mark. I look at the Properties, it says "The Device cannot start", and the hardware ID is USB\VID_15A2&PID_003F&REV_0100

 

It does not fail all the time, sometimes after flashing, it re-enumerates itself as a FSL bootloader device, which is correct.

 

By why does it fail to re-enumerate most of the time?

Labels (1)
Tags (2)
0 Kudos
9 Replies

1,021 Views
weapon
Senior Contributor I

Hi SP,

I recalled I met similar problem before but not in s08jm, please have a try to increase the delay for the re-enumrate in Bootloader_Main function. I listed the code snippet below.

if(ReEnumerateNow == YES) {
          // Force Re-enumeration
          CTL_USBEN = 0;                // Disable USB controller
          USBCTL0 = 0;                  // Disable PHY and Pull-Up
    
          for(i=0;i<25000;i++){           // delay----------increase delay here,you may try to 60000 here to see if there is improvment. 
              for(j=0;j<255;j++) {
                  asm(nop); 
                  asm(nop); 
                  asm(nop); 
              }
          }
     

Hope it can work.

B.R

Weiping

0 Kudos

1,021 Views
leesp
Contributor I

Hi Weiping,

I tried, but it still does not work. So the below code increase the delay by ~7 times

      CTL_USBEN = 0;

      USBCTL0 = ;

      for(i=0;i<60000;i++) //original was 25000

      {

         for(j=0;j<255;j++)

         {

             asm(nop);

             asm(nop);

             asm(nop);

             asm(nop); //added 6 more NOP

             asm(nop);

             asm(nop);

             asm(nop);

             asm(nop);

             asm(nop);

}

}

Don't know why sometimes it works, sometimes it doesn't.

I used a software USB analyser to analyse, it says bmaxpacketsize0 = 16, but it should be 8 for low speed.

In the code we set bmaxpacketsize0 to 16. Should we change this?

0 Kudos

1,021 Views
leesp
Contributor I

I changed bmaxpacketsize0 to 8.

It is even worse. Detected as unknown device!

0 Kudos

1,021 Views
leesp
Contributor I

When it fails, the data from USBlyzer looks like this:

Connection Status Device connected

Current Configuration 0

Speed Low (1.5 Mbit/s)

Device Address 0

Number Of Open Pipes 0

Device Descriptor

Offset Field Size Value Description

0 bLength 1 12h 

1 bDescriptorType 1 01h Device

2 bcdUSB 2 0200h USB Spec 2.0

4 bDeviceClass 1 00h Class info in Ifc Descriptors

5 bDeviceSubClass 1 00h 

6 bDeviceProtocol 1 00h 

7 bMaxPacketSize0 1 10h Should be 8 bytes for low-speed devices

8 idVendor 2 15A2h Freescale Semiconductor, Inc.

10 idProduct 2 003Fh 

12 bcdDevice 2 0100h 1.00

14 iManufacturer 1 01h 

15 iProduct 1 02h 

16 iSerialNumber 1 00h 

17 bNumConfigurations 1 01h 

0 Kudos

1,021 Views
weapon
Senior Contributor I

Hi SP

thanks for those info. I'll have a try in demo board.

B.R

Weiping

0 Kudos

1,021 Views
leesp
Contributor I

Hi Weiping,

Have you try it in your demo board already?
I still cannot solve my problem..

0 Kudos

1,021 Views
weapon
Senior Contributor I

hi SP,

Really sorry for so late reponse becuase of long holiday. I just found a demo board with s08jm60. seems it works well. I'm using windows 7.

Did you use demo board? Did you try to get power from usb and external?

an3927.jpg


B.R

Weiping

0 Kudos

1,021 Views
leesp
Contributor I

Hi,

I tried the DEMOJM board, it always works. However, if i try it on my application board which has a USB hub comtroller IC chip in between the host and MCU, it sometimes fails.

I tried to run another Freescale bootloader (JM60, AN3561) on my application board, it always work too.

It makes me worry that AN3927 does not always work with a USB hub controller IC chip.

My application board gets the power from external, not the Vbus. So, the USB hub controller and MCU get the power from the same external source.

Please help.

0 Kudos

1,021 Views
weapon
Senior Contributor I

Hi SP,

It's hard to us to locate your issue as we haven't similar board in our handles.  can you use USB protocol analyzer to capture  the whole packets in enumration proccess? 

B.R

weiping

0 Kudos