Skip to main content
Visitor II
April 30, 2024
Question

stm32L452CEU6 usb doesnt work with Samsung GalaxyTab A8

  • April 30, 2024
  • 6 replies
  • 10912 views

I have a board design based on stm32L452 , USB gets recognized on a windows PC and I can talk to the device over any software like putty and a Test software sees the com port and can to the device. However in Android (Iam using samsung  GalaxyTab A8), usb is not even recognized. The Tab support OTG mode and I did change default USB mode in the tab (Tried all the combo, file transfer, teethering, media etc). Nothing helps. Any advice is greatly appreciated

 

    This topic has been closed for replies.

    6 replies

    Super User
    April 30, 2024

    Maybe you need a CDC host driver for Android ...?

    see:

    https://github.com/mik3y/usb-serial-for-android

     

    Super User
    April 30, 2024

    @anees wrote:

    I have a board design based on stm32L452 , USB gets recognized on a windows PC and I can talk to the device over any software like putty 


    So you've implemented CDC ?

    Does that tablet recognise any other CDC devices ?

    Does your STM32 see any attempt from the tablet to start enumerating ?

    aneesAuthor
    Visitor II
    May 2, 2024

    1.So my board with stm32 is detected in windows and apple. But not in android , CDC driver is implemented on device

    2. Yes the tablet sees other device,

    3. When you bring up android settings, and developer options enable and usb in setting, in transferring file mode...other modes are disabled or greyed out.  So not ensure what enumeration stage it is...

    4. https://github.com/mik3y/usb-serial-for-android , is this code available in c# equivalent, does this change needed in android to make it work?

    aneesAuthor
    Visitor II
    May 2, 2024

    typeA to MicroB connected, galaxy Tablet said "media device detected". But no communication or serial comm and no enumeration, same result in galaxy s2. Then test on ipadPro .. usbA to usbC dongle, its said usb accessory.. still have to check if comm port can communicate with ipad.

    We want to user galaxy A8,

    Super User
    May 2, 2024

    Just about :  typeA to MicroB  -- there are two types of adapter: to connect a device (usb stick, cdc..) or a host (PC) .

    The micro usb has a pin for this , that is on gnd or not - depending on adapter type.

    So check, you use the matching = phone-> device adapter . Try connect another usb-serial adapter to the usb-A , to test.

    aneesAuthor
    Visitor II
    May 3, 2024
    some more back ground regarding the issue,
    I have been using STM-32 NUCLEO development boards (see below), which have been functioning as expected, detecting device and communicating with Android and able to send & receive over USB serial port:
    NUCLEO-U575ZI-Q (ordered from DigiKey)
    497-NUCLEO-U575ZI-Q-ND
    NUCLEO-144 STM32U575ZI EVAL BRD
    I have created our Android App to successfully communicate over USB serial port as desired with the STM-32 NUCLEO development board.
     
    But we had to build the new hardware around stm32UL. 
     
    The problem is that we can't currently detect and communicate with the new hardware and we need to know if there is a fix, such as a software workaround. We are using C# language (not JAVA), others details below.
    Although we tried the JAVA example sent by ST, the following Android App also didn't detect the new hardware: https://github.com/mik3y/usb-serial-for-android
     
    To be clear the new hardware based on stm32UL gets USB detected and work correctly from a terminal program or our own app in windows and macos. 
     
    Our Android tablet App was previously functioning with STM-32 development board and would allow our Android App to detect and communicate over USB serial port.
    However, when we switch to the new board/device and plug it into the same USB-C port in the Android tablet, our App shows no devices indicated as being available on the USB port.
    Target Android Tablet: Samsung Galaxy Tab A8 10.5"
    Android .apk build, environment & library details:
    Environment: Windows 11Pro, Microsoft Visual Studio Editors (multiple), Unity 2019.4.x
    'Android Studio' used to download and install all necessary Android Build Support modules: Android SDK, NDK, OpenJDK, JAVA drivers, any other necessary drivers.
    Target Android OS Level: API level 31 (both Minimum and Target API Level)
    Scripting Backend: Mono (also works with IL2CPP), code is entirely written in C# (not JAVA)
    Api Compatibility Level: .NET Standard 2.0 (also works with .NET 4.x)
    Visitor II
    May 3, 2024

    Hi I'm Anees,


    We are using HSI48 (crystal less) for L452 board.

    Program generated with CubeMX for A and B.
    There is only one library available, which is CDC ACM. Using same library for both boards

    Super User
    May 3, 2024

    So can you try  48M for USB from HSE/PLL ?

    + wich optimizer setting for project you use?

    aneesAuthor
    Visitor II
    May 3, 2024

    Thanks, we are updating the code as per your suggestions and about to try. One other information is that USBCRS_SYNC (PA10 AF10 function) Is routed in the board to connector. But the USB cable do not have any pins for this? And datasheet doesnt explain what USBCRS_SYNC pin do? can anyone explain about this pin

    aneesAuthor
    Visitor II
    May 3, 2024

    Does this mean this pin is needed for working with Android Tablet? wondering why it has no issue with windows/Mac

    Super User
    May 3, 2024

    No, nothing about "Samsung" here. :)

    IF you select it as sync source (see my last post) you need it as sync input . (If you use crystal less.)

     

    >wondering why it has no issue with windows/Mac

    Just lucky. Connect it to 10 different PCs , maybe 8 work, 1 sometimes, 1 never . (Without sync used to adjust the HSI.)

     

    Thats why i wrote : try with HSE ---> usb-clk. Just to  exclude the clock problem.

     

    IF using crystal less , use ->

    AScha3_0-1714755577530.png

     

    aneesAuthor
    Visitor II
    May 3, 2024

    Was using HSI crystal less , as you suggested changed to  HSE ---> usb-clk ...

    No impact, works in mac/windows but not in android. With this change,  may be I saw unknown usb detect error from windows few times.

    Also tried changing USB_CRS_SYNC to RESET_STATE in ioc. In our board even though this signal is routed to USB connected, usb cable doesnt take this anywhere.  So still fighting the not able to talk to android issue.

    What else can be tried? Should we try as a USB mass storage and see if android can detect that to isolate if its on android side or device side?

    Visitor II
    May 6, 2024

    Mass storage class showing same issue, detecting on Windows, but not detecting on Android.

    The external clock (HSE) using now.

    Below showing the schematic in which USB_DM and USB_SYNC is interchanged. Is there any possibility to work the USB in windows, if this pins are interchanged?

    jaindevasy_0-1714999864761.png

     

    Super User
    May 6, 2024

    >Is there any possibility to work the USB in windows, if this pins are interchanged?

    No - hey, but everything is possible in certain reality. :)

    If really mixed up - correct it. And try connection then...

    Visitor II
    May 6, 2024

    We will check that.

    How we can enable debug message from USB lib and where we can see these messages?