cancel
Showing results for 
Search instead for 
Did you mean: 

USBX Outputs Garbage

kumaichi
Associate III

Still trying to get USBX to work, I can now get data out to Putty but it's all garbage and after each send it "dings" (very annoying).  I used the H5 example to get it working, last hurdle I guess.  Putty is set to 115200, 1 stop bit, 8 data bits just like the configuration:

 

#define MIN_BAUDRATE     9600

UX_SLAVE_CLASS_CDC_ACM_LINE_CODING_PARAMETER CDC_VCP_LineCoding =
{
  115200, /* baud rate */
  0x00,   /* stop bits-1 */
  0x00,   /* parity - none */
  0x08    /* nb. of bits 8 */
};

 

Anything else I can check? This is what I'm seeing:

kumaichi_0-1726157705752.png

Kindest regards

 

4 REPLIES 4
FBL
ST Employee

Hi @kumaichi 

Ensure that your USB connections are secure and that there are no loose connections. Sometimes, a faulty USB cable can cause data corruption. Ensure that the buffers used are not corrupted in memory.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

kumaichi
Associate III

I switched cables and ports with no better result.  However, stepping into the method, _ux_device_class_cdc_acm_write, it fails because it thinks the device isn't configured:

 

    /* As long as the device is in the CONFIGURED state.  */
    if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
    {
            
        /* Error trap. */
        _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_CONFIGURATION_HANDLE_UNKNOWN);

        /* If trace is enabled, insert this event into the trace buffer.  */
        UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_CONFIGURATION_HANDLE_UNKNOWN, device, 0, 0, UX_TRACE_ERRORS, 0, 0)
    
        /* Cannot proceed with command, the interface is down.  */
        return(UX_CONFIGURATION_HANDLE_UNKNOWN);
    }

 

My device -> ux_slave_device_state is 0.  I haven't figured out why it doesn't think it's configured.  Maybe that is my problem?

Kindest regards

kumaichi
Associate III

I've gotten nowhere with this.  I used the same cable and port on a f446 Nucleo board, NOT using USBX and the string is written out to the terminal window just fine.  Try USBX on the U535 and it's all garbage.  And one other thing I noticed, if I don't put a '\r\n' at the end of the buffer, it doesn't even attempt to write out garbage, it does nothing.

I debugged into the LL code and the buf is correct, doesn't look like the data is corrupted in any way.

If someone out there has a U535 would you be so kind as to load the attached CubeIde project and see if it writes out garbage for you as well?  Would be greatly appreciated.

Kindest regards

Hi @kumaichi 

It seems you are mixing FDCAN semaphore while configuring USBX CDC stack. Follow the example provided in standalone.

STM32CubeU5/Projects/NUCLEO-U545RE-Q/Applications/USBX/Ux_Device_CDC_ACM at main · STMicroelectronics/STM32CubeU5 (github.com)

It is working on my end using Nucleo U545.

 

FBL_0-1727087639033.png

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.