usb msd

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

usb msd

1,493 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rolanddeluca on Wed Jun 01 16:29:49 MST 2011
I am trying to compile and run the usb msd demo in release mode on a lpc1343 lpcxpresso brd in xp but it will not connect.:mad:

If I compile and run debug code it works fine. I can see the drive and read the txt file.

I tried usbconnect and usbvbus circuits below with no success.
http://www.microbuilder.eu/Files/Projects/LPC1343RefDesign/LPC1343_Schematic_v1.6.pdf

any help appreciated.:confused:
0 Kudos
Reply
8 Replies

1,472 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Jun 03 05:02:30 MST 2011
Even worse: 2 resistors :eek:

http://knowledgebase.nxp.com/showthread.php?t=1972
0 Kudos
Reply

1,472 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ktownsend on Fri Jun 03 04:54:26 MST 2011

Quote: Zero
The original sample (with changed 'volatile' in delay) is working here without problems with Windows 7 and also XP. But of course I use my own hardware without prehistoric transistor :)
So I would suggest to try a few other computers and then use a FET.



Ouch :)

A FET would indeed mean one resistor less, but I only have about 25 8mm reels on the pick and place machine (since they're like 500€ a piece) so I try to use the same common parts are much as possible to avoid changing reels all the time (just me being lazy, yes).  Pick and place machines are expensive enough, but it's the reel holders that kill you in the long run!
0 Kudos
Reply

1,472 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Thu Jun 02 11:26:26 MST 2011

Quote: Rob65

If one of my old NXP embedded programming colleagues would have written this we would have put him/her in a straight jacket and let him watch a Microsoft Windows programmer at work for a whole week.



Was that for punishment or enlightenment?:confused::)


Quote: Zero
But of course I use my own hardware without prehistoric transistor :)
So I would suggest to try a few other computers and then use a FET.



Could you elaborate on that or show your circuit?:)
0 Kudos
Reply

1,472 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Jun 02 11:12:50 MST 2011
The original sample (with changed 'volatile' in delay) is working here without problems with Windows 7 and also XP. But of course I use my own hardware without prehistoric transistor :)
So I would suggest to try a few other computers and then use a FET.
0 Kudos
Reply

1,472 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rolanddeluca on Thu Jun 02 11:00:39 MST 2011
Looks like its the optimization level -O2.   Works only with  -00 or -01.
No drawing and quartering required.:)
0 Kudos
Reply

1,472 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rolanddeluca on Thu Jun 02 10:51:14 MST 2011
[SIZE=2]thanks, tried Zero's suggestion [COLOR=#7f0055][COLOR=#7f0055][B]volatile i [/B][COLOR=#000000]in delay with some success. I[/COLOR][/COLOR][/COLOR][COLOR=#7f0055][COLOR=#7f0055][COLOR=#000000]ts now connects and reads the ID but its not enumerating the endpoint. [/COLOR][/COLOR][/COLOR][/SIZE][SIZE=2]:rolleyes:[/SIZE]
0 Kudos
Reply

1,472 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Thu Jun 02 01:41:16 MST 2011

Quote: Zero
Try to add volatile in usbhw.c [COLOR=Blue](blue is new[/COLOR]):

void delay (uint32_t length ) {
  [COLOR=Blue]volatile[/COLOR] uint32_t i;

  for ( i = 0; i < length; i++ );
  return;
}



Remind me to exorcise all NXP example code from my PC :eek:
Lesson 1 of any programming class will tell you that this is a very bad way of programming.

If one of my old NXP embedded programming colleagues would have written this we would have put him/her in a straight jacket and let him watch a Microsoft Windows programmer at work for a whole week
Too bad it is not allowed to draw and quarter (DE: vierteilen) anymore (I might forget to program Asimov's laws in my next robot though :rolleyes:)

Making the variable volatile is the quick and dirty way of solving this unforgettable bug in NXP's example project.
The correct way of solving this is of course by using the systick timer to program a delay for a certain number of clock cycles. The current function will in no way delay the amount of clock cycles requested but an n-fold of cycles.

Regards,

Rob
0 Kudos
Reply

1,472 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Jun 01 17:05:03 MST 2011
Try to add volatile in usbhw.c [COLOR=Blue](blue is new[/COLOR]):

void delay (uint32_t length ) {
  [COLOR=Blue]volatile[/COLOR] uint32_t i;

  for ( i = 0; i < length; i++ );
  return;
}
0 Kudos
Reply