Combined TBDML/OSBDM Code for the JM16/32/60 (USBDM)

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

Combined TBDML/OSBDM Code for the JM16/32/60 (USBDM)

21,863 Views
pgo
Senior Contributor V
Dear All,

Attached is the latest version of the USBDM code and hardware description.


Enjoy.

USBDM_JM60_Distribution1.zip
Message Edited by t.dowe on 2009-08-28 04:59 PM
Tags (2)
0 Kudos
Reply
102 Replies

1,316 Views
pgo
Senior Contributor V

Dear enrico,

 

I have been unable to find anything to account for the problems on several of you PCs. I have tried a number of different PCs without any problems.  I have also reviewed the code.

 

In the absence of any definite approach I have re-written part of the USB handling code to hopefully make it a bit more robust.  I would appreciate if you could try the attached version and see if there is any improvement.

 

I'm unsure of how much time and resources you have available to track down this bug.  If you could indicate your willingness I will provide a version of the code with extra debugging and ask you to try the BDM out with the Codewarrior debugger and check for particular happenings.

 

bye

 

USBDM_JMxxCLD.zip

Message Edited by t.dowe on 2009-08-28 05:16 PM
0 Kudos
Reply

1,316 Views
enrico
Contributor I

Dear pgo,

 

I've tried to do a simple trace on the code, setting some breakpoints where the program (I think)

sends the "stall". I found a point in "handleGetDescriptor" in "bdm.c" where the " switch() " jumps

to "default". On "working" PCs the program doesn't pass for this point.

I don't know how USB driver works so I am not sure this info could be useful;

I've attached a file with "snapshot" of the situation at breakpoint, together with the last piece

of the program flow.

 

bye

Enrico

 

program_flow.txt

Message Edited by t.dowe on 2009-08-28 05:17 PM
0 Kudos
Reply

1,316 Views
pgo
Senior Contributor V

Dear Enrico,

 

Good job of debugging - This was exactly the information I would ask for.  Unfortunately I still can't find the problem.

 

Attached are some comments and a description of the diagnosis so far :smileyhappy:

There is also an updated project to try.

 

I would appreciate if you re-do your debugging with this project as outlined in the PDF.  It would be also useful if you could provide an updated USB trace if you still have the equipment.

 

Thanks!

 

Program_flow.pdf

PackAndGo.zip

 

 

Message Edited by t.dowe on 2009-08-28 05:19 PM
0 Kudos
Reply

1,316 Views
enrico
Contributor I

Dear pgo,

 

Now the problem seems a bit more clear.

Testing the "official" code, I've found that the "byte swapping" code is correctly working,

but it swaps the "older" contents of ep0SetupBuffer, because when ep0SaveOutData() is

called ep0BDTOut.byteCount is zero; so ep0SetupBuffer, that is filled with old setup

request data, is "re-swapped" to its original content.

Note: at the time ep0SaveOutData() is called and ep0BDTOut.byteCount is zero, the contents of

ep0OutDataBuffer seems to be OK.

 

Then I have tried the project you posted...

On this code there is no more "stall" sent (I think because there is no "byteCount" check on

data copy...:smileyvery-happy: )

But also this code doesn't work on my "not working" pc! (It works correctly on my "working" pc)

The good news are that with this code the USB enumeration seems to be OK... I've attached

the two enumeration logs for comparison.

 

Now the problem could be on the PC, but if this is the case, I don't know how to resolve it;

I've already tried to uninstall the device, and rebooting the pc, but the situation did'n change.

Pheraps I need a "registry cleaner" for installed USB devices...

 

Note: I've not tried the previous test code (the one you posted on 30/04) with USB analyzer,

pheraps it was not sending any "stall" as the last test code.

 

Thank you

Enrico

 

logs.zip

Message Edited by t.dowe on 2009-08-28 05:19 PM
0 Kudos
Reply

1,316 Views
pgo
Senior Contributor V

Dear enrico,

 

Good progress! 

 

I'm a little unclear about the situation.

 

As you indicated, I can confirm that the USB trace shows that the device has enumerated correctly and been set an address and has responded to a further transaction after  being addressed.

 

Does the device appear in the Hardware manager?  If so  you should be able to re-install the driver from there.  Is there a problem with the driver installation or does the problem lie elsewhere?

 

There is a utility testUSBDM in the original software that can be used to check communication with the BDM.

 

bye

Message Edited by pgo on 2009-05-07 12:27 PM
0 Kudos
Reply

1,316 Views
enrico
Contributor I

Dear pgo,

 

Despite the new USB trace seems correct, I have exactly the same issues that I described on my

first posts (I can view the device on Hardware manager, but it tolds me that drivers are uninstalled;

if I try to reinstall the drivers, it says me that the correct driver (?) is already installed and there are no

other drivers available; if I uninstall and reconnect the USBDM, it never asks me for a driver, and says

that there was an error; ecc. ecc. ). The TestUSBDM utility tolds me that there are no found devices.

 

Now I think the problem could be one of these:

 - The enumeration routine could still be not perfect (timing problems, ecc);

  but USB analyzer should detect this kind of situation...

  (but it seems to me that the USB analyzer I've used is a bit too "poor" to detect anything...);

 - The PC is "messed up" because I've connected the "faulty" USBDM, and refuses to work correctly

  (until, for example, I reinstall the whole OS, but it's a bit hard to try; I have no more "fresh" PC to try,

  because I have connected the  faulty USBDM on all the PCs that were available to me).

 

Do you have any idea of what will be the next test step?

 

Thank you very much

Enrico

0 Kudos
Reply

1,316 Views
pgo
Senior Contributor V

Dear enrico,

 

Please try the attached image which I expect will be more successful.

 

I have made some changes to the setup for the USB OUT endpoints.

 

 I have tested this version and it passes the USB compliance test from USB.org.

 

Let me know how it works with your PCs.

 

bye

Message Edited by pgo on 2009-05-09 11:02 PM
Message Edited by t.dowe on 2009-10-13 10:22 AM
0 Kudos
Reply

1,316 Views
enrico
Contributor I

Dear pgo,

 

I've tried the test code v1.5 and it works on all six PCs I've used for test!

 

I've attached for reference the USB log files made on two of the previously

"not working" PCs. The log is different from the ones of my last posts.

Also on some PCs with winXP where the USBDM was already working, the OS

now re-asks for the drivers: it seems that the USBDM is recognized in a

"different way"...

 

P.S.: I've tried both the "old" USBDM code and the last v1.5 code with USBCheck

(the older version of USBCV that works on win2K) and it reported in both cases

the same result, that the USBDM was "1.1 compliant"!

So I think that it should not have been easy for you to find the solution... :smileywink:

 

Very good job and thank you very much for your support!

Let me know if you need more testing...

 

Enrico

 

Working.zip

Message Edited by t.dowe on 2009-10-13 10:23 AM
0 Kudos
Reply

1,316 Views
Macias
Contributor I

Dear pgo,

 

I was tryed your updated code and it works correctly on my "not working" PC.

Thanky you!

 

Best Regards,

Macias

0 Kudos
Reply

1,316 Views
Macias
Contributor I

Dear enrico,

 

I've this same problem with my USBDM based on JM60 (CLD). When I connect it to my Acer Notebook with Intel chipset every think works fine. WinXP recognized my hardware. But when I connect it to my desktop PC (with SiS chipset) I see nice message: "USB Device was not recognize" I see it in Device Manager as Unknown Device, but I seen some intersting think when I connect/disconnect USBDM 5-6 time (fast), winXP recognize this device correct.

With another USB examples from freescale I haven'tany problems every think was recognized.

 

Best Regards,

Macias

0 Kudos
Reply

1,316 Views
enrico
Contributor I

Dear Macias,

 

I think the same strange behaviour happened to me,

when I was trying my USBDM with USB analyzer on my laptop running winXP.

Initially the USBDM wasn't recognized, but after some "connect/disconnect" cycles, winXP

correctly found the device. I think that a quick repetitive restart of handshake"tricks" the USB

connection driver, making it believe that the enumeration "continues", when in fact is not (it could be?).

This behaviour could be related to the first "stall" issue I've seen on some of my PC.

 

Unfortunately, this trick didn't seem to work on win2K (I have weared out my USB plug in trying,

but nothing happened... :smileysad:)

 

Thank you

Enrico

0 Kudos
Reply

1,316 Views
pgo
Senior Contributor V

Dear All,

June Release of USBDM for JMxx.

You might also be interested in the JB16 version:

 

Combined TBDML/OSBDM Code

 

This release also provides a version that supports Coldfire V2, 3 & 4 targets.

 

History
  • V1.5 (June 2009)
    • Improved/corrected connection strategy for external power cycling
    • Minor bug fixed (glitch removal)
    • Improvements to ALT clock handling
    • Changes to USB code to fixed bugs with BDM being recognized on some PCs (Thanks to Macias & Enrico for bug chasing and testing) Tested with USBCV13.exe from USB.ORG - now passes
  • V1.4 (February 2009)
    • Fixed a bug in the USB code (unlikely to occur but worth fixing)
    • Added extra dialogues prompting the user to cycle target power when necessary. Corresponding options added.
    • Added connection retry when target power is absent.
    • Added support for MC51AC256 (a bit of a hack!)
    • Modified HCS macros (to provide considerable size reduction as needed for USBDM_CF in 16K)
    • General clean up of code
  • V1.3 (November 2008)
    • Unified Timer MACROS
    • Re-arrangement of Target Vdd control routines
    • Minor mods & corrected comments in bdm_syncMeasure()
    • Reviewed stack size
    • Increased cable_status.waitX size
  • V1.2 (October 2008)
    • Increased stack size (stack overflow was possible)
    • Utilities (setBoot) updated to match.
    • Other cosmetic changes
  • V1.1 (August 2008)
    • Vista compatibility
    • Fixed several bugs related to use of 1T45 buffers (Witztronics etc.)
  • V1.0 Initial Release

Enjoy.

 

1. Installation.zip

USBDM_JMxx.zip

USBDM_CF_JMxx.zip

Message Edited by pgo on 2009-06-07 04:56 PM
Message Edited by pgo on 2009-06-07 05:02 PM
Message Edited by pgo on 2009-06-07 05:08 PM
Message Edited by t.dowe on 2009-09-01 09:48 AM
0 Kudos
Reply

1,316 Views
LightElf
Contributor I

Dear pgo,

 

what is about firmware sources and gerber files? 

 

0 Kudos
Reply

1,316 Views
pgo
Senior Contributor V

Dear LightElf,

 

Source code & PCB files for USBDM_JMxx(/CF).

 

No changes to the PCB for the USBDM H/W, Added CF version.

Unified Software for both versions

 

USBDM/CF_JMxx PCB Version V1.5

USBDM_JMxx            Version 1.6 (no changes)

Unified S/W              Version 1.5

 

bye

 

2. Source.zip

3. PCB.zip

Message Edited by pgo on 2009-06-18 10:01 AM
Message Edited by pgo on 2009-06-18 10:02 AM
Message Edited by t.dowe on 2009-09-01 09:59 AM
0 Kudos
Reply

1,316 Views
helloshi
Contributor II

Dear all

:smileysad:

 

Is it work correct? 

 

BDM_INTERFACE

Message Edited by helloshi on 2009-06-16 02:22 PM
Message Edited by t.dowe on 2009-10-13 10:24 AM
0 Kudos
Reply

1,316 Views
pgo
Senior Contributor V

Dear helloshi,

 

What have you got against FETs?

 

And surely R27 isn't 10K?

 

bye

0 Kudos
Reply

1,316 Views
helloshi
Contributor II

Dear pgo,

 

Sorry, R27 is 100R.

 

I have only transistor.

 

It can be normal to use ?

 

bye

0 Kudos
Reply

1,316 Views
pgo
Senior Contributor V

Dear helloshi,

 

Re: Using BSTs

 

I just prefer FETs as they have negligible drive current.

 

However, looking at the circuit again I would have some concerns about R9 turning on when the RST line is pulled low.  RST going low would pull the base of Q9 low through the BE junction of Q10.  This would turn on Q9.  This might not be apparent in voltage measurements but might result in excessive current from the Flash supply.  Even when RST is high I would expect Q9 to be partially on if VPP is 12V.

 

Finally I would have to think about how Q10 & Q11 work and my brain's too tired at the moment :smileyhappy:

 

bye

 

 

Message Edited by pgo on 2009-06-18 07:55 PM
0 Kudos
Reply

1,316 Views
helloshi
Contributor II

Dear pgo,

 

      Thank you for your guidance. I understand it.:smileyhappy:

However,Can you talk about the role of the Q4 ,in your circuit.

 

 

 

thanks a lot.

bye.

 

Message Edited by helloshi on 2009-06-18 01:45 PM
Message Edited by t.dowe on 2009-10-13 10:25 AM
0 Kudos
Reply

1,316 Views
pgo
Senior Contributor V

Dear Helloshi,

 

Please see the discussion in the following thread (page 2) which describes the same circuit used by the JB16 version of USBDM.

 

Combined TBDML/OSBDM Code

 

bye

 

0 Kudos
Reply

1,316 Views
helloshi
Contributor II
Dear pgo,
Thanks for your help ,I got it now.:smileyvery-happy:
I'll try it ,Thanks a lot again.
bye
0 Kudos
Reply