USB host KL26 problems with CDC-ACM

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

USB host KL26 problems with CDC-ACM

838 Views
matteodavanzo
Contributor II

Hi everyone,

I'm facing with some problem working with the usb host (stack 4.1.1) on a kl26 microcontroller, interfacing with a cellular module.

I've tried with 2 different series module of the same manufacturer.

With the first one everything works fine, i see the CDC-ACM interfaces, i can choose one and i can send / receive data through USB.

With the same code, on the second module something goes wrong. I can enumerate the device, i see the CDC-ACM interfaces and i'm able to choose one. Problems comes in when i try to send 4 bytes of data. What i've noticed is that something goes wrong with the USB_INTERRUPT_PIPE on endpoint 2. The response is "Bus timeout". 

On the other module everything works fine and it responds with one data0 code result.

The other different thing is that the first module for the interrupt pipe uses the endpoint 1 and for data (in and out) the endpoint 2, instead the second module uses for interrupt pipe endpoint 2 and for data (in and out) endpoint 1.

I don't think the different numeration of the endpoints could be a problem but i'm really struggeling to understand what is happening without any result at the moment. 

Any idea could be really appreciated. I attach some debug of the two cases, maybe could help.

______________________________________________________________

Working module flow:

usb_hostdev_open pipe ep 1
pipeptr ep 1 dir 0
pipe interrupt
ptr interr_pipe 0x20004EAC
- CDC ctrl int attach Event - State = att Intf N = 0 Class = 2 SubClass = 2
usb_hostdev_open pipe ep 1
pipeptr ep 2 dir 0
pipe bulk
usb_hostdev_open pipe ep 2
pipeptr ep 2 dir 1
pipe bulk
ptr in_pipe 0x20004EE4
ptr out_pipe 0x20004F1C
- CDC data int attach event - State = att Intf N = 1 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 2 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 3 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 4 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 5 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 6 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 7 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 8 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 9 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 10 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 11 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 12 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 13 Class = 10 SubClass = 0
- CDC ctrl int 0 selected -
- Device installed -
- CDC data int 1 selected -

epN 0 , pipeType 0
TR_CTRL epnum 0 , pipe->bdptr = 0x20004C18, ep_ptr->tx_bd = 1
result bd = 0x00080008
bd switch = 0x02
epN 0 , pipeType 0
TR_IN epnum 0 , pipe->bdptr = 0x20004C08, ep_ptr->rx_bd = 1
result bd = 0x00000068
bd switch = 0x0A
TR_IN epnum 0 , pipe->bdptr = 0x20004C00, ep_ptr->rx_bd = 0
result bd = 0x0000006C
bd switch = 0x0B
epN 1 , pipeType 3
TR_IN epnum 1 , pipe->bdptr = 0x20004C08, ep_ptr->rx_bd = 1
result bd = 0x000A000C
bd switch = 0x03

TR_MSG_SEND: remain 4
epN 2 , pipeType 2
TR_OUT epnum 2 , pipe->bdptr = 0x20004C10, ep_ptr->tx_bd = 0
result bd = 0x00040008
bd switch = 0x02
res 4

______________________________________________________________

Not working module flow:

usb_hostdev_open pipe ep 1
pipeptr ep 2 dir 0
pipe interrupt
ptr interr_pipe 0x20004EAC
- CDC ctrl int attach Event - State = att Intf N = 0 Class = 2 SubClass = 2
usb_hostdev_open pipe ep 1
pipeptr ep 1 dir 0
pipe bulk
usb_hostdev_open pipe ep 2
pipeptr ep 1 dir 1
pipe bulk
ptr in_pipe 0x20004EE4
ptr out_pipe 0x20004F1C
- CDC data int attach event - State = att Intf N = 1 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 2 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 3 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 4 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 5 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 6 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 7 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 8 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 9 Class = 10 SubClass = 0
- CDC ctrl int attach Event - State = att Intf N = 10 Class = 2 SubClass = 2
- CDC data int attach event - State = att Intf N = 11 Class = 10 SubClass = 0
- CDC ctrl int 0 selected -
- Device installed -
- CDC data int 1 selected -

epN 0 , pipeType 0
TR_CTRL epnum 0 , pipe->bdptr = 0x20004C18, ep_ptr->tx_bd = 1
result bd = 0x00080008
bd switch = 0x02
epN 0 , pipeType 0
TR_IN epnum 0 , pipe->bdptr = 0x20004C08, ep_ptr->rx_bd = 1
result bd = 0x0000006C
bd switch = 0x0B
epN 2 , pipeType 3
TR_IN epnum 2 , pipe->bdptr = 0x20004C00, ep_ptr->rx_bd = 0
result bd = 0x00000040
bd switch = 0x00
res = atom_tr_to

TR_MSG_SEND: buf A , remain 4
epN 1 , pipeType 2
TR_OUT epnum 1 , pipe->bdptr = 0x20004C10, ep_ptr->tx_bd = 0
result bd = 0x00040000
bd switch = 0x00
res = atom_tr_to
TR_OUT epnum 1 , pipe->bdptr = 0x20004C18, ep_ptr->tx_bd = 1
result bd = 0x00040000
bd switch = 0x00
res = atom_tr_to
TR_OUT epnum 1 , pipe->bdptr = 0x20004C10, ep_ptr->tx_bd = 0
result bd = 0x00040000
bd switch = 0x00
res = atom_tr_to
TR_OUT epnum 1 , pipe->bdptr = 0x20004C18, ep_ptr->tx_bd = 1
result bd = 0x00040000
bd switch = 0x00
res = atom_tr_to
res -16

______________________________________________________________

Thanks everybody

Best regards,

Matteo

Labels (2)
Tags (4)
0 Kudos
Reply
2 Replies

698 Views
matteodavanzo
Contributor II

Hi everybody, 

i've discovered something. A strange thing happens.

If i call usb host init and start calling usb_khci_task before the completion of the boot up of the module, everything works fine.

If i wait 20 seconds from the power up of the module and then i call usb host init and usb khci task the same behaviour of the previous message happens, it always give to me "bus timeout".

Any ideas about that?

Thank you

Matteo 

0 Kudos
Reply

698 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Matteo Davanzo

My recommendation is to use the latest version of USB stack, it comes with the SDK software that can be downloaded in our page:

Welcome | MCUXpresso SDK Builder 

It has resolved some bugs that were found in this old version which now is no longer supported.

Have a great day,
Jorge Alcala

0 Kudos
Reply