Tuto HID mousse with nucleo411

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
P@T
Posts: 33
Joined: Tue Nov 06, 2018 2:37 pm

Tuto HID mousse with nucleo411

Post by P@T » Wed May 13, 2020 11:53 am

Hi,

I try the tutorial with a board nucleo411 but it is possible ?
I don't know how to access the boot file ...
I don't see : usb_mode

Code: Select all

>>> MicroPython v1.12-371-gf534b9976 on 2020-04-15; NUCLEO-F411RE with STM32F411xE
Type "help()" for more information.
>>> import pyb
>>> pyb.
__class__       __name__        main            stop
RTC             ADC             ADCAll          ExtInt
Flash           I2C             LED             Pin
SPI             Switch          Timer           UART
bootloader      country         delay           dht_readinto
disable_irq     elapsed_micros  elapsed_millis  enable_irq
fault_debug     freq            hard_reset      info
micros          millis          mount           repl_info
repl_uart       standby         sync            udelay
unique_id       wfi
>>>  
Well, someone could give me some advice ?

Thank you

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Tuto HID mousse with nucleo411

Post by dhylands » Wed May 13, 2020 1:24 pm

The USB connector on the nucleo411 is connected to the STINK MCU on the nucleo board. There is no USB connector connected to the STM32F411, so the USB functionality is disabled by default. This is why there is no usb_mode function.

In order to get USB functionality to work, you'd need to wire up a USB connector and rebuild the firmware with USB enabled.

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: Tuto HID mousse with nucleo411

Post by shaoziyang » Wed May 13, 2020 1:44 pm

USB is disable in Nucleo64 board default, because it doesn't have a USB socket for STM32. You may enable usb by add line below in mpconfigboard.h.

#define MICROPY_HW_ENABLE_USB (1)

P@T
Posts: 33
Joined: Tue Nov 06, 2018 2:37 pm

Re: Tuto HID mousse with nucleo411

Post by P@T » Wed May 13, 2020 3:00 pm

thank you for your response.

In DFU mode there is a USB port on stm32f411 ? PA_11 and PA_12

Image

I try to rebuild a firmware (it's the first time, I hope it's not hard)

P@T
Posts: 33
Joined: Tue Nov 06, 2018 2:37 pm

Re: Tuto HID mousse with nucleo411

Post by P@T » Wed May 13, 2020 3:04 pm

I'm sorry shaoziyang, i didn't see your answer.

I'm going to add this line and follow the instructions.
(If i have any problems, I can ask for your help ?)

Thank you

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: Tuto HID mousse with nucleo411

Post by shaoziyang » Thu May 14, 2020 1:17 am

After enable usb in mpconfigboard.h, you need build source and update firmware. Then connect PA11/PA12 to a usb adapter board.
microusb.png
microusb.png (107.85 KiB) Viewed 5151 times
Image

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: Tuto HID mousse with nucleo411

Post by shaoziyang » Thu May 14, 2020 1:32 am

I have also make a nucleo shield board before.

viewtopic.php?f=12&t=2343&p=13430#p13430

Image

P@T
Posts: 33
Joined: Tue Nov 06, 2018 2:37 pm

Re: Tuto HID mousse with nucleo411

Post by P@T » Thu May 14, 2020 12:18 pm

Hi,

I have to add the line 7

Code: Select all

#define MICROPY_HW_BOARD_NAME       "NUCLEO-F411RE"
#define MICROPY_HW_MCU_NAME         "STM32F411xE"

#define MICROPY_HW_HAS_SWITCH       (1)
#define MICROPY_HW_HAS_FLASH        (1)
#define MICROPY_HW_ENABLE_RTC       (1)
#define MICROPY_HW_ENABLE_USB       (1)
and I have a problem :

Code: Select all

pat@pat-3000-N100:~/micropython/ports/stm32$ make BOARD=NUCLEO_F411RE
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
GEN build-NUCLEO_F411RE/genhdr/moduledefs.h
GEN build-NUCLEO_F411RE/genhdr/qstr.i.last
usb.c:56:2: error: #error Unable to determine proper MICROPY_HW_USB_MAIN_DEV to use
 #error Unable to determine proper MICROPY_HW_USB_MAIN_DEV to use
  ^~~~~
../../py/mkrules.mk:88: recipe for target 'build-NUCLEO_F411RE/genhdr/qstr.i.last' failed
make: *** [build-NUCLEO_F411RE/genhdr/qstr.i.last] Error 1
make: *** Suppression du fichier « build-NUCLEO_F411RE/genhdr/qstr.i.last »

an idea please ? a comment in usb.c ?
Thank you

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: Tuto HID mousse with nucleo411

Post by shaoziyang » Thu May 14, 2020 2:21 pm

Macro MICROPY_HW_USB_FS also need to be set to enable USB.

// USB config
#define MICROPY_HW_USB_FS (1)

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: Tuto HID mousse with nucleo411

Post by shaoziyang » Thu May 14, 2020 2:38 pm

Macro MICROPY_HW_USB_FS also need to be set to enable USB.

// USB config
#define MICROPY_HW_USB_FS (1)

Post Reply