Repository: betaflight/betaflight-configurator

Issue #2859: usb_hid_cdc not working correctly
Created: 2022-03-18T03:20:47Z
Describe the bug
Setting usb_hid_cdc = on causes Betaflight not to detect FC anymore until FC is re-flashed.
Using older FC firmware does not resolve issue.
Using Betaflight configurator 10.7.2 allows usb_hid_cdc to be enabled and also allows fc to be detected and modified as expected.
To Reproduce
Windows 10
Betaflight configurator 10.8.0 RC3
FC is MATEKF722SE
To recreate---

Flash FC to 4.3.0 RC3
Go to CLI and type (set usb_hid_cdc = on)
save above command

After this I was not able to access FC configurator until FC was re-flashed in part 1.
Expected behavior
FC should be able to be accessed but you cannot currently access them until re-flashed.
Configurator version
10.8.0
Flight controller configuration
# 
# diff

# version
# Betaflight / STM32F7X2 (S7X2) 4.3.0 Feb  1 2022 / 20:14:54 (3267f0417) MSP API: 1.44
# config: manufacturer_id: MTKS, board_name: MATEKF722SE, version: b020e572, date: 2022-01-16T20:04:31Z

# start the command batch
batch start

board_name MATEKF722SE
manufacturer_id MTKS

# serial
serial 2 2048 115200 57600 0 115200

# beeper
beeper -BAT_CRIT_LOW
beeper -BAT_LOW
beeper -GPS_STATUS
beeper -ON_USB

# aux
aux 0 0 1 1425 2100 0 0
aux 1 1 0 900 1150 0 0
aux 2 13 3 1300 2100 0 0
aux 3 28 0 1825 2100 0 0
aux 4 35 2 1300 2100 0 0
aux 5 36 5 1300 2100 0 0

# vtxtable
vtxtable bands 5
vtxtable channels 8
vtxtable band 1 BOSCAM_A A FACTORY 5865 5845 5825 5805 5785 5765 5745 5725
vtxtable band 2 BOSCAM_B B FACTORY 5733 5752 5771 5790 5809 5828 5847 5866
vtxtable band 3 BOSCAM_E E FACTORY 5705 5685 5665 5645 5885 5905 5925 5945
vtxtable band 4 FATSHARK F FACTORY 5740 5760 5780 5800 5820 5840 5860 5880
vtxtable band 5 RACEBAND R FACTORY 5658 5695 5732 5769 5806 5843 5880 5917
vtxtable powerlevels 4
vtxtable powervalues 0 1 2 3
vtxtable powerlabels 25 200 600 1W2

# master
set gyro_lpf1_static_hz = 287
set gyro_lpf2_static_hz = 575
set dyn_notch_count = 1
set dyn_notch_q = 500
set gyro_lpf1_dyn_min_hz = 287
set gyro_lpf1_dyn_max_hz = 575
set acc_calibration = 62,42,266,1
set mid_rc = 1505
set min_check = 1005
set max_check = 1995
set dshot_idle_value = 400
set dshot_bidir = ON
set motor_pwm_protocol = DSHOT600
set small_angle = 180
set deadband = 7
set yaw_deadband = 7
set pid_process_denom = 4
set simplified_gyro_filter_multiplier = 115
set osd_tim_2_pos = 2516
set osd_mah_drawn_pos = 2083
set osd_altitude_pos = 2498
set osd_warnings_pos = 14793
set osd_avg_cell_voltage_pos = 2100
set vtx_band = 5
set vtx_channel = 5
set vtx_power = 4
set vtx_low_power_disarm = UNTIL_FIRST_ARM
set vtx_freq = 5806
set gyro_1_align_pitch = 1800
set gyro_1_align_yaw = 1800
set gyro_2_align_yaw = 900

profile 0

# profile 0
set dterm_lpf1_dyn_min_hz = 78
set dterm_lpf1_dyn_max_hz = 157
set dterm_lpf1_static_hz = 78
set dterm_lpf2_static_hz = 157
set p_pitch = 56
set i_pitch = 101
set d_pitch = 53
set f_pitch = 173
set p_roll = 51
set i_roll = 92
set d_roll = 46
set f_roll = 158
set p_yaw = 51
set i_yaw = 92
set f_yaw = 158
set d_min_roll = 34
set d_min_pitch = 39
set simplified_master_multiplier = 110
set simplified_d_gain = 105
set simplified_pi_gain = 105
set simplified_feedforward_gain = 120
set simplified_pitch_pi_gain = 105
set simplified_dterm_filter_multiplier = 105

rateprofile 0

# rateprofile 0
set thr_mid = 0
set thr_expo = 60
set rates_type = BETAFLIGHT
set roll_rc_rate = 165
set pitch_rc_rate = 165
set yaw_rc_rate = 150
set roll_expo = 22
set pitch_expo = 22
set yaw_expo = 20
set roll_srate = 70
set pitch_srate = 70
set yaw_srate = 65

# end the command batch
batch end

Add any other context about the problem that you think might be relevant here
Note: currently don't have a second instant of BF on a different computer. Will attempt at a friends in the future soon.
I have left my diff setup below but don't know if it will help. This dump doesn't have the usb_hid_cdc set to on. This is caz if I do, well I can't access CLI. :(

Duplicate issue #2924: set usb_hid_cdc=on breaks ability to connect until firmware reflashed
Created: 2022-05-14T23:40:29Z
Describe the bug
On betaflight 10.7.2 and firmware 4.2.11 (GEPRCF411), usb_hid_cdc mode was working fine.  Since flashing 4.3.0-rc6 of the firmware (GEPRCF411) and upgrading to 10.8.0.rc6 of betaflight, if I set usb_hid_cdc=ON then I cannot connect to betaflight until I reflash the FC.  This happens consistently, and with no modifications from the custom defaults that come with the firmware.


Driver of Betaflight STM32F411 Interface 1 is WinUSB (v6.1.7600.16385) (I have also tried this with libusb-win32 (v1.2.6.0))


Driver of Betaflight STM32F311 Interface 0 is HidUsb (v10.0.19041.868)


OS is Windows 10 x64: Edition Windows 10 Pro; Version 21H1; Installed on ‎13/‎09/‎2020; OS build 19043.1706; Experience Windows Feature Experience Pack 120.2212.4170.0


To Reproduce
set usb_hid_cdc=on; save;
After doing that, drone reboots and I cannot connect any more ("Failed to open serial port").
Expected behavior
Connect should work and the receiver should work as a game controller.
Configurator version
10.8.0 rc6
Flight controller configuration
# 

# diff all

# version
# Betaflight / STM32F411 (S411) 4.3.0 Apr 25 2022 / 01:03:20 (9d71184) MSP API: 1.44
# config: manufacturer_id: GEPR, board_name: GEPRCF411, version: 7b156dec, date: 2021-07-26T13:19:23Z

# start the command batch
batch start

# reset configuration to default settings
defaults nosave

board_name GEPRCF411
manufacturer_id GEPR
mcu_id 003e00303030511737393838
signature 

# master
set acc_calibration = 82,62,172,1

profile 0

profile 1

profile 2

# restore original profile selection
profile 0

rateprofile 0

rateprofile 1

rateprofile 2

rateprofile 3

rateprofile 4

rateprofile 5

# restore original rateprofile selection
rateprofile 0

# save configuration
save
# 

Add any other context about the problem that you think might be relevant here
Update: I tried the solution offered in #2859 and it didn't work for me:
Before enabling (USB_HID_CDC=OFF):
With show all serial devices off and nothing connected:  Manual selection : "/dev/rfcomm0"
With show all serial devices on and nothing connected: Manual selection : "/dev/rfcomm0"
With show all serial devices off and quad connected: COM3 - Betaflight STM32F411 / Manual selection : "/dev/rfcomm0"
With show all serial devices on and quad connected: COM3 - Betaflight STM32F411 / Manual selection : "/dev/rfcomm0"
After enabling USB_HID_CDC=ON:
With show all serial devices off and nothing connected:  Manual selection : "/dev/rfcomm0"
With show all serial devices on and nothing connected: Manual selection : "/dev/rfcomm0"
With show all serial devices off and quad connected: Manual selection : "/dev/rfcomm0"
With show all serial devices on and quad connected: Manual selection : "/dev/rfcomm0"

Closing comment (2022-05-15T00:00:07Z): Duplicate of #2859