cancel
Showing results for 
Search instead for 
Did you mean: 

Azure RTOS USBX CDC ACM example on NUCLEO-H743ZI2 call to "ux_utility_memory_compare" in "usbx_cdc_acm_read_thread_entry" always fails to match, can't pull the slave interface and never receives data.

MLeon.2
Associate

I'm using a NUCLEO-H743ZI2 board and following the examples in Ux_Device_CDC_ACM targeting H723 and Ux_Device_HID_CDC_ACM targeting H747, but no data ever comes in and fails to match the "ux_utility_memory_compare" function in "usbx_cdc_acm_read_thread_entry". I can't seem to find where the interface is, and why the API as is isn't working.

/* Get Data interface */
data_interface = device->ux_slave_device_first_interface->ux_slave_interface_next_interface;
 
/* Compares two memory blocks ux_slave_class_name and _ux_system_slave_class_cdc_acm_name */
ux_status = ux_utility_memory_compare(data_interface->ux_slave_interface_class->ux_slave_class_name,
     _ux_system_slave_class_cdc_acm_name,
     ux_utility_string_length_get(_ux_system_slave_class_cdc_acm_name));
 
/* Check Compares success - Always fails this check */
if (ux_status == UX_SUCCESS)

The USB port registers on my computer and I can see baud rate change request call-backs to "ux_app_parameters_change", but the "usbx_cdc_acm_read_thread_entry" never receives data because it can't match the correct slave interface struct.

I plan to try an older version of CUBE MX since the examples are based on those and the code is structured a little different, but are there any known issues here? I also couldn't find the reasoning for doing the check to begin with other than the fact that the callback function wants pull the configured USBX interface and make sure its the right one. Not sure why the interface can't be stored to a static pointer unless the api moves these around dynamically.

Last bit of info to provide (Since I've been bit by memory configs in the past) is that I use the same MPU config as recommended even though USB DMA is not enabled, there shouldn't be anything special going on here. 

  .usbx_data 0x24027000 (NOLOAD): 
  {  
    *(.UsbHpcdSection)
  } >RAM_D1
  
  .uart_bss 0x24028000 (NOLOAD): 
  { 
    *(.UsbxAppSection)
  } >RAM_D1
  
  .usbx_bss 0x24029000 (NOLOAD): 
  { 
    *(.UsbxPoolSection)
  } >RAM_D1

0693W00000QLN6NQAX.png

1 ACCEPTED SOLUTION

Accepted Solutions
MLeon.2
Associate

Easy solution. The interface existed in there as I could see it in memory, but missed that you can set to 0 for the interface assignment. This code here works and was in the original example.

  /* Registers a slave class to the slave stack. The class is connected with
     interface 0 */
  if (ux_device_stack_class_register(_ux_system_slave_class_cdc_acm_name,
       ux_device_class_cdc_acm_entry, 1, 0, (VOID *)&cdc_acm_parameter) != UX_SUCCESS)
 
// Instead of 
  /* Registers a slave class to the slave stack. The class is connected with
     interface 1 */
  if (ux_device_stack_class_register(_ux_system_slave_class_cdc_acm_name,
       ux_device_class_cdc_acm_entry, 1, 1, (VOID *)&cdc_acm_parameter) != UX_SUCCESS)

View solution in original post

1 REPLY 1
MLeon.2
Associate

Easy solution. The interface existed in there as I could see it in memory, but missed that you can set to 0 for the interface assignment. This code here works and was in the original example.

  /* Registers a slave class to the slave stack. The class is connected with
     interface 0 */
  if (ux_device_stack_class_register(_ux_system_slave_class_cdc_acm_name,
       ux_device_class_cdc_acm_entry, 1, 0, (VOID *)&cdc_acm_parameter) != UX_SUCCESS)
 
// Instead of 
  /* Registers a slave class to the slave stack. The class is connected with
     interface 1 */
  if (ux_device_stack_class_register(_ux_system_slave_class_cdc_acm_name,
       ux_device_class_cdc_acm_entry, 1, 1, (VOID *)&cdc_acm_parameter) != UX_SUCCESS)