• hi,
    I am trying to input data to a pico from a USB barcode reader (in either HID or virtual com mode).
    OTG is not required , USB would be a dedicated input.
    Happy to dig deeper and get a logic analyser on the case but USB low level signalling is a new world for me. Searching the forums :

    So my questions here are:

    • has anything moved on since the above conversations with USB peripheral input to the pico?
    • is there any way forward to ustilise the USB host functionality of the STM32F401xD ?
    • is an additional host controller chip/shield the only practical way to crack this? Seems a really unnecessary overhead if the STM.. can handle the host interface.

    and any suggestions on investigations I could do to move this forward appreciated.

    Thanks in Advance
    Simon

  • Hi Simon,

    I'm afraid nothing has progressed on USB Host. While possible with the hardware (although I think most implementations add some kind of USB switch device?) there'd be a lot of software work required in Espruino, and that hasn't been done.

    So I think your main options would be:

    • There is a MicroPython port for the Pico (I'm not sure how old it is) and that may support USB Host - at least MicroPython supports it on their own boards.
    • You could write the code you need in C using ST's libraries - depending on what you're after and if there's an example already that may actually be the easiest option
    • There's the external shield option - but that could still be a decent amount of work

    Sorry to not have better news!

  • Thanks Gordon,
    Thanks for the confirmation and the clear options. I’ve been doing some more googling and checked out the libraries and stm32 reference docs. I think it’s possible but I have to say it looks incredible complex.
    On a general point this https://youtu.be/4FOkJLp_PUw

    is a great youtube tutorial with stm32 that shows the logic analyser techniques (and effort ) it might take to debug such a development.

  • I’ll investigate a bit more , Signed up to Udemy course on interfaces in embedded c, for stm32 !!! but no promises.

    Out of interest , and maybe mid term answer to my problem, have you decided if, the new Espruino Wi-fi Board might support USB host ! Or use hardware that could. ? If one was going to invest time in this maybe it be better spent that way.

    Thanks again for considered response.
    And Happy new year.

  • I'm pretty sure the new Wifi won't support USB Host I'm afraid - it'll be using the nRF52840 which supports device only :(

  • Indeed :(
    But that’s good to know in any event.
    PICO it is then.
    Will let the forum know how I get on, in the c driver, usb host , stm library world !

  • Hi,
    Quick status, having spent some time on this, Im going to make a serious attempt at adding a USB host functionality option on the Pico build for host HID support.
    Approach maybe with a with a new E.USBSetHost, function that can be used in conjunction with the existing E.USBSetHID to set the mode between: USB device Virtual com (default) , USB Device with HID or USB Host for HID. ie set to host on next USB insert of the board.

    Will add discussion on an approach for comment after more learning on my part.
    status So far:
    Working thru Udemy course embedded driver development for STM32.
    Learnt how to successfully build Espruino and flash to Pico on Ubunto box
    Currently getting to grips with the current Pico USB build: Looking at the STM libraries currently employed, working back from STM32_USB.make, using STM Library docs. , understanding how E.USBSetHID is implemented.

    Found great basic USB tutorial.
    https://www.st.com/content/st_com/en/sup­port/learning/stm32-education/stm32-mooc­s/STM32-USB-training.html

    Trying to get hold of a STM32F407G DISC BOARD for the development as it has debug capability and USB wired up to STF32F4.... But struggling on availability, just spoke to Anglia Live sales rep to complete questionnaire on my 'project' to justify having stock allocated to me !
    So told her this was a project to enhance the Espruino project , hope that is enough.

    If ok , will raise an issue for an enhancement 'Provide USB Host functionality on Pico' on Github to formalise the work, in case it helps with supply issue of the dev board. And then can have discussion there on the approach .
    Cheers Simon

  • Just heard the discovery board has been dispatched :)

  • From the GitHub commits and changes of the STM drivers in Espruino (targetlibs/stm32usb/Src/) back in 2015 , it looks like GWilliams was very busy and there were a ton of changes to the STM libraries to get USB working in Espruino. SO .... clearly changing existing functionality to use more recent STM libraries is not agood idea ! So approach has to be that any Host functionality is all incremental and sits beside existing device virtual com and HID. However that also makes sense, looking at the current STM host libraries in
    https://www.st.com/resource/en/user_manu­al/dm00105256-stm32cube-usb-host-library­-stmicroelectronics.pdf

    ... they would be a parallel set to the existing device libraries on the stack. See Attached pic.


    1 Attachment

    • stacks.JPG
  • complicated ....... still early days. update in a couple of weeks.

  • Realised that given my requirement is to input to pico from usb barcode readers that are usually capable of output in virtual com mode, then may only need host CDC capability on the pico and not need host HID also. So will start with host CDC .

  • Initially , looks like CDC is an easier implementation and needing fewer library files.
    Interested in others view , if you only had one usb class of input. HID or virtual com ?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

USB host on Pico- do we need a host controller chip ?

Posted by Avatar for SimonGAndrews @SimonGAndrews

Actions