0

CircuitPython and STM32F405 Feather Express
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

CircuitPython and STM32F405 Feather Express

by sidprice on Sat Apr 03, 2021 11:58 am

I am having trouble updating code while using CircuitPython on my STM32F405 Feather Express. Working on Windows, when I drop a new "code.py" onto the Feather drive it loads but the Feather does not reboot to use that code. I have to press reset to get the new code running. Pressing reset means the Feather is disconnected from the computer and so a few extra steps are required to iterate the code.

Is this a known issue or is there a recommended fix?

sidprice
 
Posts: 34
Joined: Thu Jan 02, 2014 2:40 pm

Re: CircuitPython and STM32F405 Feather Express

by danhalbert on Sat Apr 03, 2021 3:14 pm

1. What version of CircuitPython are you running?
2. What editor are you using?
3. Are you seeing the >>> prompt in the REPL when you're editing the program? If you are in that state, a write of code.py will not restart the program.

Upload or paste your code.py between [ CODE ] [ /CODE ] tags so we can take a look.

danhalbert
 
Posts: 2332
Joined: Tue Aug 08, 2017 12:37 pm

Re: CircuitPython and STM32F405 Feather Express

by sidprice on Sat Apr 03, 2021 3:56 pm

1. What version of CircuitPython are you running?

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit Feather STM32F405 Express with STM32F405RG

2. What editor are you using?

Notepad++

3. Are you seeing the >>> prompt in the REPL when you're editing the program?

I am NOT editing "code.py" directly on the Feather, I have it on my computer, I edit using Notepad++, then, after saving it, I drag it onto the Feather drive. If go to my terminal emulator and use CTRL-C I do see the ">>>" prompt.

Code: Select all | TOGGLE FULL SIZE
import board
import time

####################
# Define the LP5036 register addresses
#
####################

LP5036_DEVICE_CONFIG0 = 0x00
LP5036_DEVICE_CONFIG1 = 0x01
LP5036_LED_CONFIG0 = 0x02
LP5036_LED_CONFIG1 = 0x03
LP5036_BANK_BRIGHTNESS = 0x04
LP5036_BANK_A_COLOR = 0x05
LP5036_BANK_B_COLOR = 0x06
LP5036_BANK_C_COLOR = 0x07
LP5036_LED0_BRIGHTNESS = 0x08
LP5036_LED1_BRIGHTNESS = 0x09
LP5036_LED2_BRIGHTNESS = 0x0a
LP5036_LED3_BRIGHTNESS = 0x0b
LP5036_LED4_BRIGHTNESS = 0x0c
LP5036_LED5_BRIGHTNESS = 0x0d
LP5036_LED6_BRIGHTNESS = 0x0e
LP5036_LED7_BRIGHTNESS = 0x0f
LP5036_LED8_BRIGHTNESS = 0x10
LP5036_LED9_BRIGHTNESS = 0x11
LP5036_LED10_BRIGHTNESS = 0x12
LP5036_LED11_BRIGHTNESS = 0x13
LP5036_OUT0_COLOR = 0x14
LP5036_OUT1_COLOR = 0x15
LP5036_OUT2_COLOR = 0x16
LP5036_OUT3_COLOR = 0x17
LP5036_OUT4_COLOR = 0x18
LP5036_OUT5_COLOR = 0x19
LP5036_OUT6_COLOR = 0x1a
LP5036_OUT7_COLOR = 0x1b
LP5036_OUT8_COLOR = 0x1c
LP5036_OUT9_COLOR = 0x1d
LP5036_OUT10_COLOR = 0x1e
LP5036_OUT11_COLOR = 0x1f
LP5036_OUT12_COLOR = 0x20
LP5036_OUT13_COLOR = 0x21
LP5036_OUT14_COLOR = 0x22
LP5036_OUT15_COLOR = 0x23
LP5036_OUT16_COLOR = 0x24
LP5036_OUT17_COLOR = 0x25
LP5036_OUT18_COLOR = 0x26
LP5036_OUT19_COLOR = 0x27
LP5036_OUT20_COLOR = 0x28
LP5036_OUT21_COLOR = 0x29
LP5036_OUT22_COLOR = 0x2a
LP5036_OUT23_COLOR = 0x2b
LP5036_OUT24_COLOR = 0x2c
LP5036_OUT25_COLOR = 0x2d
LP5036_OUT26_COLOR = 0x2e
LP5036_OUT27_COLOR = 0x2f
LP5036_OUT28_COLOR = 0x30
LP5036_OUT29_COLOR = 0x31
LP5036_OUT30_COLOR = 0x32
LP5036_OUT31_COLOR = 0x33
LP5036_OUT32_COLOR = 0x34
LP5036_OUT33_COLOR = 0x35
LP5036_OUT34_COLOR = 0x36
LP5036_OUT35_COLOR = 0x37
LP5036_RESET = 0x38

LP5036_ADDRESS_A = 0x30
LP5036_ADDRESS_B = 0x31

LP5036_COLORS = bytes([255,255,255])

Bright = 127

i2c =board.I2C()
#
# Lock the I2C bus before we use it
#
while not i2c.try_lock():
   pass
#
# Power up the "A" LP5036
#
i2c.writeto(LP5036_ADDRESS_A, bytes([LP5036_DEVICE_CONFIG0, 0x40]))
#
# Configure the "A" LP5036
#
i2c.writeto(LP5036_ADDRESS_A, bytes([LP5036_DEVICE_CONFIG1, 0x20 | 0x10 | 0x08 | 0x04]))
#
# Power up the "B" LP5036
#
i2c.writeto(LP5036_ADDRESS_B, bytes([LP5036_DEVICE_CONFIG0, 0x40]))
#
# Configure the "B" LP5036
#
i2c.writeto(LP5036_ADDRESS_B, bytes([LP5036_DEVICE_CONFIG1, 0x20 | 0x10 | 0x08 | 0x04]))

for led in range(11):
    i2c.writeto(LP5036_ADDRESS_A, bytes([LP5036_LED0_BRIGHTNESS+led, 0]))
    i2c.writeto(LP5036_ADDRESS_A, bytes([LP5036_OUT0_COLOR+(led*3), 0, 0, 0]))

#
# Turn on/off one LED using Dominic's white balanced color set
#
while True:
   i2c.writeto(LP5036_ADDRESS_A, bytes([LP5036_LED0_BRIGHTNESS, Bright]))
   i2c.writeto(LP5036_ADDRESS_A, bytes([LP5036_OUT0_COLOR, 135, 123, 255]))
   time.sleep(.5)
   i2c.writeto(LP5036_ADDRESS_A, bytes([LP5036_OUT0_COLOR, 0,0,0]))
   i2c.writeto(LP5036_ADDRESS_A, bytes([LP5036_LED0_BRIGHTNESS, 0]))
   time.sleep(.5)
i2c.unlock()

sidprice
 
Posts: 34
Joined: Thu Jan 02, 2014 2:40 pm

Re: CircuitPython and STM32F405 Feather Express

by danhalbert on Sat Apr 03, 2021 6:11 pm

Dragging the file onto CIRCUITPY or writing with Notepad does not necessarily write out the file immediately. This is an issue with Windows and to a lesser extent with Linux. See https://learn.adafruit.com/welcome-to-c ... 3086831-24.

After you drag the file, go to the lower right of the task bar, and find the icon representing a USB stick. Click on it and "Eject" the drive. It will not really eject, but the file write will be forced to happen immediately.

Let us know if this does not work. Also try CircuitPython 6.2.0-rc.0, though I think the above may fix the problem.

danhalbert
 
Posts: 2332
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.