Install Micropython

Hi everybody,
I would like to do some python with my brainpad (Rev A.):

But Nothing append: no serial port appears.

Any help would be appreciated :wink:

It should simply work! There is nothing special there.

It should, but I Don’t have any drive or COM port appearing !

I’ve tried:

But nothing better: no sound when I reset board, no drive, no unknown device in device manager. :sob:
I’m on Win 10 64bits in case it can help.

1 Like

checked on source code

// UART config
#define MICROPY_HW_UART2_TX (pin_A2)
#define MICROPY_HW_UART2_RX (pin_A3)
#define MICROPY_HW_UART6_TX (pin_C6)
#define MICROPY_HW_UART6_RX (pin_C7)
// UART 2 connects to the STM32F103 (STLINK) on the Nucleo board
// and this is exposed as a USB Serial port.
#define MICROPY_HW_UART_REPL PYB_UART_2
#define MICROPY_HW_UART_REPL_BAUD 115200

i belive you can use with any UART (PA2,PA3) to use Micropython on BrainPad

Last time I tried this kit worked over USB. Not sure what had changed.

@gus_issa I have succeeded to build v1.9.1, you used on video and it works. I will try to find Which version is broken (for brainpad).

USB and com port can’t be accessible since v1.9.4.
But it can be enable by adding two lines in mpconfigboard.h (from 1.9.4 to actual master):

#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:

// USRSW is pulled low. Pressing the button makes the input go high.
...

// USB config
#define MICROPY_HW_USB_FS (1)

// LEDs
...

So now, I can play with it ! :smile:

2 Likes

share compiled firmware :slight_smile:

I’ve trouble with blue led of light bulb. But as soon as it’s done, be sure I will share it ! :wink:

2 Likes

When you are done we should talk. We have done some work internally. We should join forces on this.

I’m done but I didn’t test all possibilities: just gpio, pwm, adc.
I don’t have play with accelerometer and display yet.

So @gus_issa: if you are ok, we can talk :wink:

@valoni: .dfu file is here:
firmware
My code for building dfu file is:

#define MICROPY_HW_BOARD_NAME       "BRAINPAD2"
#define MICROPY_HW_MCU_NAME         "STM32F401xE"

// #define MICROPY_HW_HAS_SWITCH       (1)
#define MICROPY_HW_HAS_FLASH        (1)
#define MICROPY_HW_ENABLE_RTC       (1)
#define MICROPY_HW_ENABLE_USB       (1)
#define MICROPY_HW_ENABLE_SERVO     (1)

// HSE is 8MHz, HSI is 16MHz CPU freq set to 84MHz
// Default source for the clock is HSI.
// For revisions of the board greater than C-01, HSE can be used as a
// clock source by removing the #define MICROPY_HW_CLK_USE_HSE line
#define MICROPY_HW_CLK_USE_HSI (1)

#if MICROPY_HW_CLK_USE_HSI
#define MICROPY_HW_CLK_PLLM (16)
#else
#define MICROPY_HW_CLK_PLLM (8)
#endif
#define MICROPY_HW_CLK_PLLN (336)
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV4)
#define MICROPY_HW_CLK_PLLQ (7)

// UART config
#define MICROPY_HW_UART2_TX     (pin_A2)
#define MICROPY_HW_UART2_RX     (pin_A3)
// #define MICROPY_HW_UART6_TX     (pin_C6)
// #define MICROPY_HW_UART6_RX     (pin_C7)
// UART 2 connects to the STM32F103 (STLINK) on the Nucleo board
// and this is exposed as a USB Serial port.
#define MICROPY_HW_UART_REPL        PYB_UART_2
#define MICROPY_HW_UART_REPL_BAUD   115200

// I2C busses
#define MICROPY_HW_I2C1_SCL (pin_B6)        // Arduino D15, pin 3 on CN10
#define MICROPY_HW_I2C1_SDA (pin_B7)        //         D14, pin 5 on CN10

// SPI busses
// #define MICROPY_HW_SPI1_NSS     (pin_C3)    // Arduino A2,  pin 32 on CN7
#define MICROPY_HW_SPI1_SCK     (pin_B3)    // Arduino D3,  pin 31 on CN10
#define MICROPY_HW_SPI1_MISO    (pin_B4)    // Arduino D5,  pin 27 on CN10
#define MICROPY_HW_SPI1_MOSI    (pin_B5)    // Arduino D4,  pin 29 on CN10

#define MICROPY_HW_SPI2_NSS     (pin_B12)   //              pin 16 on CN10
#define MICROPY_HW_SPI2_SCK     (pin_B13)   //              pin 30 on CN10
#define MICROPY_HW_SPI2_MISO    (pin_B14)   //              pin 28 on CN10
#define MICROPY_HW_SPI2_MOSI    (pin_B15)   //              pin 26 on CN10

// USRSW is no pulled. Pressing the button makes the input go low.
//#define MICROPY_HW_USRSW_PIN        (pin_A5)
//#define MICROPY_HW_USRSW_PULL       (GPIO_NOPULL)
//#define MICROPY_HW_USRSW_EXTI_MODE  (GPIO_MODE_IT_FALLING)
//#define MICROPY_HW_USRSW_PRESSED    (0)

// USB config
#define MICROPY_HW_USB_FS (1)

// LEDs
// #define MICROPY_HW_LED1             (pin_C6) // Blue
// #define MICROPY_HW_LED2             (pin_C8) // Green
// #define MICROPY_HW_LED3             (pin_C9) // Red

#define MICROPY_HW_LED_ON(pin)      (mp_hal_pin_high(pin))
#define MICROPY_HW_LED_OFF(pin)     (mp_hal_pin_low(pin))
2 Likes

some interesting things (to test others things)

1 Like

no link to download DFU ??

Sorry I made a mistake in link (I’ve forgotten http !). It is corrected now. Have fun !

1 Like