Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO pin configuration for USB-CDC #108

Open
jg1uaa opened this issue Nov 5, 2019 · 1 comment
Open

GPIO pin configuration for USB-CDC #108

jg1uaa opened this issue Nov 5, 2019 · 1 comment

Comments

@jg1uaa
Copy link

jg1uaa commented Nov 5, 2019

Recently I got USB supported MMDVM_HS_Hat from AliExpress, and it is programmed USB-CDC capable firmware.
I build recent MMDVM_HS firmware and installed, OpenBSD (I don't know about other OSes) cannot recognized MMDVM board like this.

Nov  6 05:48:12 framboise /bsd: ugen1 at uhub9 port 3 "LeafLabs Maple 003" rev 1.00/2.01 addr 4
Nov  6 05:48:13 framboise /bsd: ugen1 detached
Nov  6 05:48:15 framboise /bsd: uhub9: port 3, set config 0 at addr 4 failed
Nov  6 05:48:15 framboise /bsd: uhub9: device problem, disabling port 3

generic_boot20_pc13_long_rst.bin bootloader works fine, but it looks a problem when switching bootloader to MMDVM_HS software.
I used USB analyzer to investigate and I found there is a moment that MMDVM_HS cannot respond from Host(OpenBSD)'s request. Here is the log.

         SETUP ADR=3   ENP=0 DATA0 00 09 01 00 00 00 00 00   ACK  SET_CONFIGURATION
                                                                  Conf.val = 1
          I N  ADR=3   ENP=0 DATA1                           ACK
SOF=159 - 56D
SOF=71F - 7FF:000 - 03F
SOF=040  SETUP ADR=0   ENP=0 DATA0 80 06 00 01 00 00 08 00        GET_DESCRIPTOR
                                                                  (device)
         SETUP ADR=0   ENP=0 DATA0 80 06 00 01 00 00 08 00        GET_DESCRIPTOR
                                                                  (device)
         SETUP ADR=0   ENP=0 DATA0 80 06 00 01 00 00 08 00        GET_DESCRIPTOR
                                                                  (device)
         SETUP ADR=0   ENP=0 DATA0 82 00 00 00 00 00 02 00        GET_STATUS
         SETUP ADR=0   ENP=0 DATA0 82 00 00 00 00 00 02 00        GET_STATUS
         SETUP ADR=0   ENP=0 DATA0 82 00 00 00 00 00 02 00        GET_STATUS
SOF=041 - 0A2

SET_CONFIGURATION is processed by bootloader.
Launched MMDVM_HS disconnects and reconnects USB, and OpenBSD sends GET_DESCRIPTOR(device) request but there is no ACK handshake.
(note: OpenBSD always starts GET_DESCRIPTOR(device) request when USB device
is connected)

Simply I tried to get rid of GPIO_Mode_IN_FLOATING setting to GPIO_Pin_11/12
like my repo (see jg1uaa@f8d18f1), it works fine.

Nov  6 06:39:28 framboise /bsd: ugen1 at uhub9 port 3 "LeafLabs Maple 003" rev 1.00/2.01 addr 4
Nov  6 06:39:29 framboise /bsd: ugen1 detached
Nov  6 06:39:31 framboise /bsd: umodem0 at uhub9 port 3 configuration 1 interface 0 "LeafLabs Maple" rev 2.00/2.00 addr 4
Nov  6 06:39:31 framboise /bsd: umodem0: data interface 1, has CM over data, has break
Nov  6 06:39:31 framboise /bsd: umodem0: status change notification available
Nov  6 06:39:31 framboise /bsd: ucom1 at umodem0

I don't know what causes this problem.
But I think there is some misconfiguration of GPIO and mismatch between software and hardware about controlling USB connect/disconnect GPIO.

usb/usb_serial.cpp in STM32F10x_Lib controls USB connect/disconnect by GPIO PB10 (https://github.com/juribeparada/STM32F10X_Lib/blob/1debc23063f3942608e2bd62d04d5e1249c47fa3/usb/usb_serial.cpp#L50), but is this already used by I2C module?
(Used bootloader is enahnced version of LeafLab's Maple board, this uses PB9 to control USB connection).

Is there any good resolution to solve this problem??

@jg1uaa
Copy link
Author

jg1uaa commented Nov 7, 2019

I found this problem occurs JumboSPOT as USB bus-powered device, not occurs as self-powered device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant