0

PYBOARD V1.0 Loading CircuitPython
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PYBOARD V1.0 Loading CircuitPython

by daveshome on Sat May 08, 2021 1:29 pm

Hello

I have a PYboard 1.0. Trying to load CircuitPython on it. It came with Micropython naturally.

I have tried several ways as its not a easy drop into the virtual drive unlike newer devices.

I have tried the DFUseDemo. It only likes DFU format files. I have tried converting the CP Bin file. (Using the DFU file manager.)
No luck. Tried dfu-util to flash but I could not get it to build.
Then I tried STM Cube Programmer. It takes the bin file nicely. It seems to know to start at 0x8000000 etc. Checksum OK.
Erases, verifies. All good. After reboot, board is bricked. No COM port. No REPL. No FS. I made a hex backup of the existing Micropython load and was able to put that back. Un-bricked.

Maybe the V1.0 is not supported?
Using Windows 10. CircuitPython 6.2.0 Bin file. I have successfully built ESP chips and others to CP.

Thanks
Dave

daveshome
 
Posts: 11
Joined: Wed Jun 05, 2013 6:55 pm

Re: PYBOARD V1.0 Loading CircuitPython

by mikeysklar on Mon May 10, 2021 6:01 pm

I think you might of hit on it. I'm not seeing signs of support for the PyBoards 1.0 on our site only v1.1. Did you purchase this board from us? I was under the impression we started selling with the v1.1.

https://www.adafruit.com/product/2390
https://circuitpython.org/board/pyboard_v11/

mikeysklar
 
Posts: 4634
Joined: Mon Aug 01, 2016 8:10 pm

Re: PYBOARD V1.0 Loading CircuitPython

by daveshome on Sun May 16, 2021 3:17 am

Hi.

Yes. Purchased from Adafruit. (ORDER #708249-1611206920 February 14, 2015 )
Oh well. I guess its too old to put too much effort into. I understand that.

I am testing the Teensy 4.1. (as I need a fast board for a project.)
And I see that CircuitPython won't do PWM on it. (Arduino IDE, C, C++ work fine with PWM.)

Darn it. Maybe I will send a note to Scott about it. He seems to have so much to do already.

Thanks for your response.
Dave

daveshome
 
Posts: 11
Joined: Wed Jun 05, 2013 6:55 pm

Re: PYBOARD V1.0 Loading CircuitPython

by mikeysklar on Mon May 17, 2021 6:11 pm

Actually I thought there was basic PWM support for the Teensy as of April of this year. Please let me know if I am incorrect. I know it took forever. Was it PWMout you were intested in?

https://github.com/adafruit/circuitpython/pull/4530

mikeysklar
 
Posts: 4634
Joined: Mon Aug 01, 2016 8:10 pm

Re: PYBOARD V1.0 Loading CircuitPython

by daveshome on Mon May 17, 2021 9:28 pm

Hi.

I don't think that is for the Teensy 4.1. Searching the net. Someone sold a board on Tindie.

I just tried that example and on pin 13. I get

Code: Select all | TOGGLE FULL SIZE
main.py output:
Traceback (most recent call last):
File "main.py", line 8, in <module>
ValueError: Invalid pin


On pin 9 I get:

Code: Select all | TOGGLE FULL SIZE
main.py output:
pwm: 0x403e0000, sum 2, chan 0, mux 2
Code stopped by auto-reload.
soft reboot


Line 8:
Code: Select all | TOGGLE FULL SIZE
p = pwmio.PWMOut(board.D13, frequency=1_000_000, variable_frequency=True)
p.duty_cycle = 32868



Thanks for checking.
Dave

daveshome
 
Posts: 11
Joined: Wed Jun 05, 2013 6:55 pm

Re: PYBOARD V1.0 Loading CircuitPython

by mikeysklar on Tue May 18, 2021 11:15 am

@Dave,

The Teensy 4.1 appears to be using a mix of FlexPWM and QuadTimers. Your example being tested on D13 would fall in the quadtimer realm which is unsupported. I'm under the impression that the FlexPWM pins should work at this point with basic PWM functionality.

5E938CB9-E529-48DC-9B1A-57BBDD7884D3.jpeg
5E938CB9-E529-48DC-9B1A-57BBDD7884D3.jpeg (507.76 KiB) Viewed 313 times


https://forum.pjrc.com/threads/62007-Te ... 13-Invalid

https://www.pjrc.com/teensy/td_pulse.html

mikeysklar
 
Posts: 4634
Joined: Mon Aug 01, 2016 8:10 pm

Re: PYBOARD V1.0 Loading CircuitPython

by daveshome on Tue May 18, 2021 1:00 pm

Hello.

The pin 13 was in the example you sent me. I tried a few other pins (0 to 9) and I can't get an LED to dim.
Tried many frequencies and duty cycles. Maybe my code is faulty.

Some of the links you sent are for other Teensy boards. And with Arduino. PWM works with Arduino. (C, C++)

Please send me a test script in CircuitPython and I will run it on a few pins on my Teensy 4.1.

Thanks
Dave

daveshome
 
Posts: 11
Joined: Wed Jun 05, 2013 6:55 pm

Re: PYBOARD V1.0 Loading CircuitPython

by tannewt on Wed May 19, 2021 8:36 pm

Dave,
Please post your full code. It should work on pins that don't produce an error. Pin 9 looks like it worked but then a file write triggered a reload.
~Scott

tannewt
 
Posts: 2438
Joined: Thu Oct 06, 2016 8:48 pm

Re: PYBOARD V1.0 Loading CircuitPython

by daveshome on Thu May 20, 2021 3:44 am

Hi Scott.

I can't find the code I used. But I tested lots of pins as I see there are different types. (FlexPWM, QuadTimer)
I kept getting errors. Although the script was running. Text output after starting was "pwm: 0x403e0000, sum 2, chan 0, mux 2."
I could see no frequency on the pin under test. This microcontroller is very capable. PWM works great in C, C++.

Send me some code and I will try it. I am just flashing LED's. Not anything high frequency.

I watch your DeepDive every week and see that you have a long list of things to do.

Thanks
Dave

daveshome
 
Posts: 11
Joined: Wed Jun 05, 2013 6:55 pm

Re: PYBOARD V1.0 Loading CircuitPython

by daveshome on Fri May 21, 2021 1:23 am

Found some code I tried.

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

#First test
for freq in range(1000, 1000000, 1000 ):
    p = pwmio.PWMOut(board.D0, frequency=freq, variable_frequency=True)
    p.duty_cycle = 0
    time.sleep(.01)
    print("freq=:",freq)
   
# Second test
for duty in range(50, 32000, 500):
    p = pwmio.PWMOut(board.D0, frequency=5000, variable_frequency=False)
    p.duty_cycle = duty
    time.sleep(.01)
    print("duty=:",duty)


daveshome
 
Posts: 11
Joined: Wed Jun 05, 2013 6:55 pm

Re: PYBOARD V1.0 Loading CircuitPython

by tannewt on Fri May 21, 2021 1:22 pm

Thanks! Let's try something simpler:

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

p = pwmio.PWMOut(board.D0, frequency=5000, variable_frequency=True, duty_cycle=2**15)
time.sleep(120)


This should do a 5khz square wave with 50% duty cycle.

tannewt
 
Posts: 2438
Joined: Thu Oct 06, 2016 8:48 pm

Re: PYBOARD V1.0 Loading CircuitPython

by daveshome on Fri May 21, 2021 9:55 pm

Hi Scott
Tried. No output.
Tried 1024 to 65536 increments of 4096 for duty cycle.
Tried different frequencies too.
Tried different pins. Pins 0-9,22,23,24,25,28,29,33 the REPL puts out that diagnostic data. (pwm: 0x403dc000, sum 1, chan 2, mux 4)
Other pins the REPL puts out (Traceback (most recent call last): File "main.py", line 6, in <module> ValueError: Invalid pin)
So CP likes the FlexPWM pins. And not the QuadTimer pins.

Dave

daveshome
 
Posts: 11
Joined: Wed Jun 05, 2013 6:55 pm

Re: PYBOARD V1.0 Loading CircuitPython

by daveshome on Sat May 22, 2021 12:17 am

Scott

Here is the Arduino IDE program that I used to test PWM with.

Dave


Code: Select all | TOGGLE FULL SIZE
/*
   PWM Teensy 4.1 tests
   Tests work on all PWM pins
*/

const int Thepin = 19;      // set the the pin to test with

void setup()
{               
  pinMode(Thepin, OUTPUT);  // set the pin output
  analogWriteFrequency(Thepin, 15000); // Teensy 4.1 pin 19 to 15 kHz
}

void loop()                     
{
    analogWrite(Thepin, 250);   // Pin and intensity
    delay(2000);
    analogWrite(Thepin, 20);
    delay(2000);
}

daveshome
 
Posts: 11
Joined: Wed Jun 05, 2013 6:55 pm

Re: PYBOARD V1.0 Loading CircuitPython

by tannewt on Mon May 24, 2021 5:45 pm

Please file an issue: https://github.com/adafruit/circuitpyth ... new/choose

It should be working but apparently was broken.

tannewt
 
Posts: 2438
Joined: Thu Oct 06, 2016 8:48 pm

Re: PYBOARD V1.0 Loading CircuitPython

by daveshome on Tue Jun 01, 2021 9:11 pm

Hi Scott
Ok. Posted a bug report. (#4841)
Dave

daveshome
 
Posts: 11
Joined: Wed Jun 05, 2013 6:55 pm

Please be positive and constructive with your questions and comments.