Hello everyone,
I have a Feather M0 that I successfully installed CircuitPython on. I am able to do some simple code like print("Hello World"). Additionally, I am able to successfully make a boot.py that enables the usb_cdc.
boot.py:
import usb_cdc
usb_cdc.enable(console=True, data=True)
print(usb_cdc.data)
When looking at the boot_out.txt it shows that it works fine.
When I use the code that I wrote below without resetting the Feather M0 and just reloading using the terminal. The code works fine.
code.py:
import usb_cdc
serial = usb_cdc.data # serial object
while True:
in_data = serial.readline()
if len(in_data) > 200:
out_data = b'error reason=length\r\n'
serial.write(out_data)
split = in_data.decode().split(' ')
msg_name = split[0][1:-1] ## this will need to be adjusted based on the terminal
msg_name = msg_name.lower()
serial.write(msg_name.encode())
However, when I reset the Feather M0 with the above boot.py and code.py, it doesn't connect as a serial device now. The weird thing is that I was able to reset it fine yesterday with these same codes, but now I am having issues.
I have done a nuke.uf2 to try and fix this but to no avail. Sometimes, when I go into "safe mode" Windows will tell me that CIRCUITPY drive isn't working properly. I have done the Windows repair and no luck. Additionally, I re-did the nuke.uf2 after I get that Windows error, and still no progress.
Additionally, I used the REPL in "safe mode" and did,
import storage
storage.erase_filesystem()
Also no luck. If someone could help me with this strange bug that would be greatly appreciated.
Feather M0 not connecting after reset pushed.
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- smisyort
- Posts: 2
- Joined: Wed Sep 28, 2022 3:15 am
- smisyort
- Posts: 2
- Joined: Wed Sep 28, 2022 3:15 am
Re: Feather M0 not connecting after reset pushed.
Problem solved.
I adjusted the code.py below and it worked. My thought as to the problem was that serial.readline() was immediately called and was waiting for input. I assumed this caused the USB line to go busy and prevent the RP2040 from working properly.
import usb_cdc
serial = usb_cdc.data # serial object
while True:
if serial.in_waiting > 0:
in_data = serial.readline()
serial.reset_input_buffer()
if len(in_data) > 200:
out_data = b'error reason=length\r\n'
serial.write(out_data)
split = in_data.decode().split(' ')
msg_name = split[0][1:-1] ## this will need to be adjusted based on the terminal
msg_name = msg_name.lower()
serial.write(msg_name.encode())
I adjusted the code.py below and it worked. My thought as to the problem was that serial.readline() was immediately called and was waiting for input. I assumed this caused the USB line to go busy and prevent the RP2040 from working properly.
import usb_cdc
serial = usb_cdc.data # serial object
while True:
if serial.in_waiting > 0:
in_data = serial.readline()
serial.reset_input_buffer()
if len(in_data) > 200:
out_data = b'error reason=length\r\n'
serial.write(out_data)
split = in_data.decode().split(' ')
msg_name = split[0][1:-1] ## this will need to be adjusted based on the terminal
msg_name = msg_name.lower()
serial.write(msg_name.encode())
Please be positive and constructive with your questions and comments.