Hello,
I have a little circuit that contains featherwing neopixel & feather m0.
When I connect it on USB (through my computer) sometime all is working fine: usb drive, serial, neopixel, etc.
But sometime it's not starting at all : the embded neopixel (to give status) is just off and the code is not running (but I have the usb drive working).
With a push on reset button, it's work again.
As I need to be sure that is starting everytime without any human intervention, I need to fix that.
If you have any idea, thanks ;-)
Feather M0 Express & neopixel don't start everytime
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- lgnap
- Posts: 9
- Joined: Tue Dec 06, 2022 5:58 am
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Feather M0 Express & neopixel don't start everytime
This sounds like it might be a connection issue. Please post clear closeups of your soldering and how everything is connected.
Dave
Dave
- lgnap
- Posts: 9
- Joined: Tue Dec 06, 2022 5:58 am
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Feather M0 Express & neopixel don't start everytime
The soldering look ok overall, but I see some inconsistencies. Some joints look very dubious. I advise retouching each one with the iropn to fully melt the solder and let it flow in and around the hole/pin. See https://learn.adafruit.com/adafruit-gui ... -soldering and https://learn.adafruit.com/collins-lab-soldering for tips.
Dave
Dave
- lgnap
- Posts: 9
- Joined: Tue Dec 06, 2022 5:58 am
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Feather M0 Express & neopixel don't start everytime
Hmm. It should just work on powerup. What if you give it a push other than on the reset button?
Dave
Dave
- lgnap
- Posts: 9
- Joined: Tue Dec 06, 2022 5:58 am
Re: Feather M0 Express & neopixel don't start everytime
Which button ?
I don't have any other button than reset (I have a another reset button on featherwing neopixel but seems that make the same job than reset button on M0 itself (connect GND with reset pin))
I don't have any other button than reset (I have a another reset button on featherwing neopixel but seems that make the same job than reset button on M0 itself (connect GND with reset pin))
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Feather M0 Express & neopixel don't start everytime
No button. Just push gently on the NeoPixel board to see if it's a matter of moving the board makes it work. I'm still not convinced it's not a connection issue.
Dave
Dave
- lgnap
- Posts: 9
- Joined: Tue Dec 06, 2022 5:58 am
Re: Feather M0 Express & neopixel don't start everytime
I tried but it changes nothing :-(
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Feather M0 Express & neopixel don't start everytime
Please post the code you have loaded.
Dave
Dave
- lgnap
- Posts: 9
- Joined: Tue Dec 06, 2022 5:58 am
Re: Feather M0 Express & neopixel don't start everytime
mode.py
switch.py
pixel.py
color.py
code.py
Code: Select all
WAIT_MODE = 0
CYAN_BLINKING = 1
CYAN_SOLID = 2
RED_BLINKING = 3
RED_SOLID = 4
YELLOW_BLINKING = 5
YELLOW_SOLID = 6
Code: Select all
from digitalio import DigitalInOut, Direction, Pull
import board
import mode
force_cyan_blink = 0
force_red_blink = 0
force_yellow_blink = 0
force_yellow_solid = 0
switch10 = DigitalInOut(board.D10)
switch11 = DigitalInOut(board.D11)
switch12 = DigitalInOut(board.D12)
switch13 = DigitalInOut(board.D13)
switch10.direction = Direction.INPUT
switch11.direction = Direction.INPUT
switch12.direction = Direction.INPUT
switch13.direction = Direction.INPUT
switch10.pull = Pull.DOWN
switch11.pull = Pull.DOWN
switch12.pull = Pull.DOWN
switch13.pull = Pull.DOWN
def check_inputs_and_interrupt():
if switch13.value or force_yellow_solid:
return mode.YELLOW_SOLID
if switch12.value or force_yellow_blink:
return mode.YELLOW_BLINKING
if switch11.value or force_red_blink:
return mode.RED_BLINKING
if switch10.value or force_cyan_blink:
return mode.CYAN_BLINKING
return mode.WAIT_MODE
pixel.py
Code: Select all
import board
import neopixel
import time
import math
import color
import switch
import mode
NUM_PIXELS = 32
TIME_BETWEEN_DISPLAY_LEDS = 0.1
MOD_VALUE_FOR_BLINKING = 3
pixel_pad = neopixel.NeoPixel(board.D6, NUM_PIXELS, brightness=0.1, auto_write=False)
# one is a false (due to mod MOD_VALUE_FOR_BLINKING != 0)
cyan_blink = 1
red_blink = 1
yellow_blink = 1
def display_waiting_leds(red, green, blue, wave_delay):
global pixel_pad
position = 0
for j in range(NUM_PIXELS * 2):
position += 1
for i in range(NUM_PIXELS):
pixel_pad[i] = (
int(((math.sin(i + position) * 127 + 128) / 255) * red),
int(((math.sin(i + position) * 127 + 128) / 255) * green),
int(((math.sin(i + position) * 127 + 128) / 255) * blue),
)
if switch.check_inputs_and_interrupt() != mode.WAIT_MODE:
return
pixel_pad.show()
time.sleep(wave_delay)
def set_column(no, color):
for id_pixel in range(0, 25, 8):
pixel_pad[no + id_pixel] = color
def set_double_columns(no, color):
set_column(no, color)
set_column(no+1, color)
def update_blinking(step_id):
global cyan_blink, red_blink, yellow_blink
if step_id == mode.CYAN_BLINKING:
cyan_blink += 1
red_blink = 1
yellow_blink = 1
if step_id == mode.RED_BLINKING:
red_blink += 1
cyan_blink = 1
yellow_blink = 1
if step_id == mode.YELLOW_BLINKING:
yellow_blink += 1
cyan_blink = 1
red_blink = 1
def display_leds(step_id):
set_double_columns(0, color.CYAN if step_id > mode.CYAN_SOLID or cyan_blink % MOD_VALUE_FOR_BLINKING == 0 else color.CYAN_LOW)
set_double_columns(3, color.RED if step_id > mode.RED_SOLID or red_blink % MOD_VALUE_FOR_BLINKING == 0 else color.RED_LOW)
set_double_columns(6, color.YELLOW if step_id == mode.YELLOW_SOLID or yellow_blink % MOD_VALUE_FOR_BLINKING == 0 else color.YELLOW_LOW)
pixel_pad.show()
time.sleep(TIME_BETWEEN_DISPLAY_LEDS)
def clear():
pixel_pad.fill((0, 0, 0))
Code: Select all
CYAN = (0, 10, 150)
CYAN_LOW = (0, 1, 15)
YELLOW = (150, 150, 0)
YELLOW_LOW = (15, 15, 0)
RED = (255, 0, 0)
RED_LOW = (25, 0, 0)
Code: Select all
import mode
import switch
import pixels
import time
import microcontroller
step_id = 0
# switch.force_cyan_blink = 1
# switch.force_red_blink = 1
# switch.force_yellow_blink = 1
# switch.force_yellow_solid = 1
if __name__ == "__main__":
print('main')
while True:
print('while')
pixels.clear()
print('clear')
step_id = switch.check_inputs_and_interrupt()
print('step ', step_id)
if step_id == mode.WAIT_MODE:
pixels.display_waiting_leds(55, 55, 55, 0.05)
else:
pixels.update_blinking(step_id)
pixels.display_leds(step_id)
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Feather M0 Express & neopixel don't start everytime
The code looks reasonable. The only thing somewhat unusual is the:
I wonder if there's something to that. Maybe try putting a sleep of a bit before it.
Dave
Code: Select all
if __name__ == "__main__":
Dave
- lgnap
- Posts: 9
- Joined: Tue Dec 06, 2022 5:58 am
Re: Feather M0 Express & neopixel don't start everytime
I remove this if (maybe the reason of sometimes failing, as the system will load script a module sometime and the code is not running in this case).dastels wrote: ↑Thu Dec 08, 2022 5:20 pm The only thing somewhat unusual is the:I wonder if there's something to that. Maybe try putting a sleep of a bit before it.Code: Select all
if __name__ == "__main__":
And added a time.sleep(5), but I'd like to understand why it's needed.
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Feather M0 Express & neopixel don't start everytime
I don't know if it's needed. Consider it a test. I'm wondering if there's some sort of startup timing issue. Adding a sleep changes that dynamic. If that would fix it, then it shows that that was the problem (and provides a solution).
Why do you have that if?
Dave
Why do you have that if?
Dave
- lgnap
- Posts: 9
- Joined: Tue Dec 06, 2022 5:58 am
Re: Feather M0 Express & neopixel don't start everytime
I did the proposal you provided. But still not result :'(.
But, finally found the solution.
One cable connected on +3.3v on the feather (and that I planned to use later (so during the majority of test "in the air")) seems to create interference to start system.
I removed the cable (red in the photos above) and replaced this power I needed by a LDO33 just aside and powered by the same alimentation than the feather.
And now, it's work, every time !
So seems, indeed like suggested before an issue into powering but it's after the internal feather LDO that we have an issue.
I can't understand why a cable (not connected) can be an issue in this case. May be a little capacity? But after typical LDO we must have capacity ?
Thanks for the help ;-)
But, finally found the solution.
One cable connected on +3.3v on the feather (and that I planned to use later (so during the majority of test "in the air")) seems to create interference to start system.
I removed the cable (red in the photos above) and replaced this power I needed by a LDO33 just aside and powered by the same alimentation than the feather.
And now, it's work, every time !
So seems, indeed like suggested before an issue into powering but it's after the internal feather LDO that we have an issue.
I can't understand why a cable (not connected) can be an issue in this case. May be a little capacity? But after typical LDO we must have capacity ?
Thanks for the help ;-)
Please be positive and constructive with your questions and comments.