USB 4.0.3 CDC HOST example doesn't receive data

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

USB 4.0.3 CDC HOST example doesn't receive data

ソリューションへジャンプ
1,478件の閲覧回数
pedropol
Contributor II

I'm using the example for Freescale USB Stack v4.0.3\ProcessorExpert\Examples\Host\CDC\USB_CDC_HOST_MKL25Z128_PEx on FRDM-KL25Z board.

I can send data from Host to CDC device but not from Device to HOST. It doesn't works. Host doesn't receive nothing.

Function  _io_cdc_serial_read always return 0.

If I connect the device to a PC,  I can see, in the hyperterminal, the data sent, so the problem seems to be on the host.

I've use the size of reception buffer like num parameter but also I've tried  other different values (1; 8 ; 16 ) but nothing.

Message to receive is sent correctly to the queue.


I set a breakpoint in usb_class_cdc_in_data_callback funtion (usb_host_cdc.c file) and the line "acm_if_ptr->ctrl_state.bmStates[1] & USB_ACM_LINE_STATE_DTR  always set "len" to 0


If acm_if_ptr->ctrl_state.bmStates[1] is not  USB_ACM_LINE_STATE_DTR  is the reception disabled?

Where, and when,   is acm_if_ptr->ctrl_state.bmStates[1] set?


Where I must to set other breakpoints to debug and check if data is arriving or not?



0 件の賞賛
返信
1 解決策
983件の閲覧回数
florintoma
NXP Employee
NXP Employee

     Sorry for this late reply. I have found a bug in usb_host_cdc.c. In the usb_class_cdc_set_acm_ctrl_state() function, at lines 350 / 351 if_acm_ptr->ctrl_state.bmStates[1] should be changed with if_acm_ptr->ctrl_state.bmStates[0]. The problem was that the state was sent on the usb in big endian instead of little endian.

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
983件の閲覧回数
pedropol
Contributor II

Example has:

const CDC_SERIAL_INIT   usb_open_param = {

  USB_UART_NO_BLOCKING | USB_UART_HW_FLOW

};

Disabling USB_UART_HW_FLOW, I started to receive messages from cdc device.

Host can works without USB_UART_HW_FLOW?

I need to set anything in host, or device, to work correctly with USB_UART_HW_FLOW enabled?

0 件の賞賛
返信
984件の閲覧回数
florintoma
NXP Employee
NXP Employee

     Sorry for this late reply. I have found a bug in usb_host_cdc.c. In the usb_class_cdc_set_acm_ctrl_state() function, at lines 350 / 351 if_acm_ptr->ctrl_state.bmStates[1] should be changed with if_acm_ptr->ctrl_state.bmStates[0]. The problem was that the state was sent on the usb in big endian instead of little endian.

0 件の賞賛
返信
983件の閲覧回数
florintoma
NXP Employee
NXP Employee

If no data is received in host mode, please check if you have PORTB11 on output and set to 1. That is the enable pin for MIC2026 switch to power the USB, or you can use the code below.


      /* Trigger Enable pin for MIC2026 switch  */

   SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK;   /* enable clock gating */

   PORTB_PCR11 = PORT_PCR_MUX(1);       /* GPIO mux */

   GPIOB_PDDR |= 1<<11;                 /* output pin */

   GPIOB_PSOR |= 1<<11;                 /* set pin value to 1 */


0 件の賞賛
返信
983件の閲覧回数
pedropol
Contributor II

Thanks , but this configuration is for TWR.KL25Z board?

I'm using a modded (for have 5V on the USB connector ) FRDM-KL25Z board 

0 件の賞賛
返信