KL82 MCUExpresso USB Intermittent Failure

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

KL82 MCUExpresso USB Intermittent Failure

473 Views
apikul
Contributor II

So I have a FRDM board and a custom KL82 board that I just soldered up.

I'm using the CDC_VCOM demo from MCUExpresso.

I check `lsusb`, and I notice that NXP Semiconductors device only enumerates, on either device, about 1/3 of the time. The Freescale bootloader enumerates each time, however.

I'm going to start stepping through the function and learning their framework. I suspect it has something to do with the oscillator stabilizing? I'm not sure though. I put a bitbanged square wave as a test program along with the CDC_VCOM and I noticed that when it does not enumerate, it doesn't seem to be in the main loop either.

If anyone has any suggestions on where to look, that would be friendly I'll let you know how it goes.

ps, if gdb is any help, it seems to be hanging here:

┌──/home/ajp/mcuexpresso_examples/cdc_vcom/drivers/fsl_clock.c──────────────────┐
│1670 }1671 }16721673 /* Wait for MCG_S[CLKST] and MCG_S[IREFST]. */
>1674 while ((MCG->S & (MCG_S_IREFST_MASK | MCG_S_CLKST_MASK)) !=1675 (MCG_S_IREFST(kMCG_FllSrcExternal) | MCG_S_CLKST(kMCG_ClkOutStatExt)))1676 {1677 }‍‍‍‍‍‍‍‍‍
0 Kudos
1 Reply

345 Views
apikul
Contributor II

Update: 

I edited the Freescale drivers- fsl_clock.c in the same lines I cited in the above post, and stepping through it I saw a reference to error e9878 about clock issues, so I increased all the delay times and added delays *everywhere* in that function to try and make it work.

Nothing seemed to work, but immediately after that I added a countdown to that empty while loop so that it would return kStatus_Fail after 1500 iterations or something, and now it never fails at all! I'm not sure if because an empty block is UDB or if it fails and then tries again...


I suppose we can mark this as solved but I would appreciate some comment.

I'm using arm-none-eabi-gcc 4.9 btw (I know it's old- I'm lazy).

0 Kudos