Author Topic: STM32F4 - USB HUB library - no HAL / no SPL  (Read 11091 times)

0 Members and 1 Guest are viewing this topic.

Offline DawidTopic starter

  • Contributor
  • Posts: 17
  • Country: gb
STM32F4 - USB HUB library - no HAL / no SPL
« on: September 12, 2016, 12:15:44 pm »
Hi guys,

is there anything like that? USB hub library for STM32F4 but without that hopeless HAL? Just CMSIS and registers? Did anybody tried to do that?

EDIT: It should be 'Host'. I know, my mistake.
« Last Edit: September 12, 2016, 06:48:55 pm by Dawid »
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1277
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #1 on: September 12, 2016, 02:33:31 pm »
I use HAL on these micros without problems. Don't see them as hopeless?
We Are The Watt - Resistance Is Futile!
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #2 on: September 12, 2016, 02:47:34 pm »
The STM32F4 can be a USB host or a USB device. I am not aware that it can be a HUB device.

HUB devices do things that the ST32 cannot : provide multiple USB ports, do negociation with USB devices, control power to USB port.
So I do not think that the STM32F4 can be a HUB device.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #3 on: September 12, 2016, 04:32:55 pm »
STM32F4 have only one USB port so you cannot use it as a hub. If you are seeking to implement multiple virtual devices inside your chip try to implement the USB Composite Device class. If you are actualy looking to connect multiple USB devices (as in chips) to the host you can use some USB Hub ASIC like FE1.1s (that is a USB 2.0 chip despite the 1.1 name in the model number. It was a 1.1 chip several revisions ago but later implemented USB 2.0 without changing the pinout, so the manufacturer got lazy and kept its original part number as it is a drop in replacement.)
 

Offline DawidTopic starter

  • Contributor
  • Posts: 17
  • Country: gb
Re: STM32F4 - USB Host library - no HAL / no SPL
« Reply #4 on: September 12, 2016, 06:48:15 pm »
I'm sorry, stupid me. It should be 'host' of course.

I don't like HAL, I tried and I had more problems with that than positive results. Don't try to convince me to the HAL/SPL. I just want to know if anybody knows about any library for USB Host that does not push me into the HAL/SPL.

Thank you and I apologize for my mistake in the first post.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: STM32F4 - USB Host library - no HAL / no SPL
« Reply #5 on: September 12, 2016, 07:44:07 pm »
I'm sorry, stupid me. It should be 'host' of course.

I don't like HAL, I tried and I had more problems with that than positive results. Don't try to convince me to the HAL/SPL. I just want to know if anybody knows about any library for USB Host that does not push me into the HAL/SPL.

Thank you and I apologize for my mistake in the first post.

So far I have not seen any of it. I second your opinion on HAL/SPL which is messy as hell to me. Why can't something as simple as opening a serial port be implemented in something as simple as uart_open(USART1, 115200, 128) and have to go through all that structures, let alone the fact that even those structures aren't the whole business? If you prefer structures I might as well go directly to the hardware registers.
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #6 on: September 12, 2016, 07:59:08 pm »
Sorry, I do not know of any libraries which provide USB host via direct register access.

The Data sheets and USB Application notes are your best bet to write your own. However, I found that there is not enough information in them to write a complete driver. You may need to do some reverse engineering of the ST Hal libraries.

I found it was just easier to work with the ST libraries. Use the ST forum, if you have any problems, ask Clive !
 
The following users thanked this post: splin

Offline DawidTopic starter

  • Contributor
  • Posts: 17
  • Country: gb
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #7 on: September 12, 2016, 08:01:47 pm »
I'm very close to the decision to write my USB host (yes, I even don't know 50% of problems I need to go through :)).

In HAL annoying thing is that I prepared my own, clear, nice library to decode Manchester Code and I cannot use this because there is some conflict with the HAL drivers (I can compile the code but it does work properly). I like to know what I do and with HAL it's really hard. It's like reverse engineering the code written by somebody else.

Thank you guys! I will check the ST forum.

If you have any ideas let me know please!
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #8 on: September 12, 2016, 08:06:40 pm »
It sounds like you are thinking and trying to treat the USB as a device and device driver.

That is the wrong approach. The USB host or device is a communications stack, the HAL takes care of driving the low level hardware for you. You just pump or retrieve data from the stack, or setup or tear down the stack depending on what device is being implemented/talked to.

Does that make sense?
 

Offline DawidTopic starter

  • Contributor
  • Posts: 17
  • Country: gb
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #9 on: September 12, 2016, 08:45:17 pm »
Ok, so there is no module like for UART that gives me the data in some register? I found in the reference manual the description of some registers to setup the USB communication. Is it wrong path? I have deal with the whole data coming from the USB?
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #10 on: September 12, 2016, 09:13:18 pm »
Quote
Ok, so there is no module like for UART that gives me the data in some register?
Unlike UART the data comes in packets, so USB provides the data in a buffer. The interaction with USB is so fast that the buffer must be emptied as quickly as possible, so the USB end point is serviced by irq.
So there must be a number of layer, and each layer has buffers.

While, you can access the USB peripheral registers, it is not in any way like a serial device.
Like I said, treat it like a communications stack which has layers. Your code only needs to interact with the top layer. The USB Hal code handles everything else. That is how I used the USB CDC device and the USB Hal code.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #11 on: September 12, 2016, 10:25:15 pm »
The SPL is nothing but a set of routines that works on the registers.

So implement your task on SPL. And then trace out how the SPL sets up the registers and replicate that yourself.

Done.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32F4 - USB HUB library - no HAL / no SPL
« Reply #12 on: September 12, 2016, 10:27:30 pm »
SPL isntbthat offensive, with a few exceptions.

The biggest mistake people make with vendor libraries like the SPL is to use then in their code directly.

Once you do that, your code is hardwired to the SPL and it is difficult to migrate away from it.

Use middleware instead.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->