USB not working after cpu reset.

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

USB not working after cpu reset.

Jump to solution
557 Views
VinceTF
Contributor III

Device: mcf52258

RTOS: MQX 3.8.1

 

Operation for bootloader (bare metal) is as follows:

1) USB is working and responding fine.

2) reset cpu as shown in snippit A below.  STACK_POINTER = 0x0000, START_ADDRESS = 0x0004

3) bootloader restarts and usb works fine.

 

Operation for main application (using MQX RTOS) is as follows:

1) USB is working and responding fine.

2) Disable interrupts with _int_disable() and then execute code snippit A. STACK_POINTER = 0x9000, START_ADDRESS = 0x9004

3) Main application restarts.  Heartbeat LED and serial comm indicate it is running.  However, usb driver is non-responsive.

 

As I step through the code, I can see code where I execute the Data 0/1 toggle for my IN endpoint.  Using my usb bus tools, I can see that the usb bus is non-responsive.  Any idea what is going on here?

 

 

 

Code Snippet A

   //Disable USB interrupts

  MCF_USB_OTG_ERR_ENB = 0x00;  //disable usb error interrupts

  MCF_USB_OTG_INT_ENB = 0x00; //disable usb token interrupts

  MCF_INTC0_IMRH |= MCF_INTC_INTFRCH_INTFRC53; //Mask USB interrupt

 

  asm(move.w #0x2700,sr); //disable interrupts

 

  size_1 = *((unsigned long int *)(STACK_POINTER));   // get the stack pointer from flash

  size_2 = *((unsigned long int *)(START_ADDRESS));   // get the jump to startup address from flash

 

  // start moduleware execution - this sequence is identical to the ROM boot sequence for the processor

  asm

  {

  move.l size_1, A7;   // load stack pointer

  move.l size_2, A0;

  jmp (A0);            // jump to moduleware     

  }

 

Labels (1)
0 Kudos
1 Solution
396 Views
VinceTF
Contributor III

Tom,

Thanks for the suggestions.  In the end it turned out I was resetting the in pipe in my driver when I shouldn't have.  For some reason, it was only a problem after a reset between application and bootloader.

View solution in original post

0 Kudos
2 Replies
396 Views
TomE
Specialist II

> 2) reset cpu as shown in snippit

How is that code "resetting the CPU"? It is just starting the software again. I would not expect the hardware to be reset by that. It is possible to write drivers to try to completely reset the hardware, but programmers normally don't bother as they expect the hardware reset has just done that for them.

You may want to read through the USB chapter and reset as many registers as you can find back to their hardware reset states. In particular, set "20.4.1.14 Control Register (CTL)" back to the default to disable the controller. Likewise USB_CTRL.

Tom

397 Views
VinceTF
Contributor III

Tom,

Thanks for the suggestions.  In the end it turned out I was resetting the in pipe in my driver when I shouldn't have.  For some reason, it was only a problem after a reset between application and bootloader.

0 Kudos