https://toitlang.org/ logo
Pixelstrip on ESP32S3
# help
w
Hi, I got the ESP32-S3-DevKitC-1 and flashed it with
Copy code
jag flash esp32s3-spiram-octo
, I'm using SDK version: v2.0.0-alpha.174. I tried to get the RGB LED running with this program:
Copy code
import pixel-strip
import gpio

main:
  rgb-pin := gpio.Pin 38 --output=true
//  while true:
//    // sleep --ms=0 => 40 µs
//    // sleep --ms=1..9 => 10ms
//    // sleep --ms=10..x => 20ms..10+x
//    rgb-pin.set 1
//    sleep --ms=1
//    rgb-pin.set 0
//    sleep --ms=1

  rgb := pixel-strip.PixelStrip.uart 1 --pin=rgb-pin --invert-pin=false
  while true:
    rgb.output #[0xff] #[0xff] #[0xff]
    print "white"
    sleep --ms=1000
    rgb.output #[0xff] #[0] #[0]
    print "red"
    sleep --ms=1000
    rgb.output #[0] #[0xff] #[0]
    print "green"
    sleep --ms=1000
    rgb.output #[0] #[0] #[0xff]
    print "blue"
    sleep --ms=1000
Program compiled and downloaded fine, but on the LED nothing happened. I measured Pin 38 with an Oscilloscope an it stay permanently low. What do I miss in my program? Or is the package buggy?
Make sure that the pin 38 isn't pulled low somehow.
For example, if you have connected the pin to DO instead of DI.
Note that I didn't have an ESP32S3 with octo SPIRAM and ran the test on a board without any SPIRAM, but I doubt that would make a difference. I can try to find one, if you can't find the issue.
w
Hi @floitsch , thx for your quick answer. To make shure that everything is wired as expected I uncommeted line 6-13. Then Pin 38 toggles with 50 Hz.
The board itself came with a preinstalled firmware and the led made some rgb pattern, so everything on the board should be alright. I flashed the esp32s3-spiram-octo because it was the only image that booted without a psram error. BTW the board a china clone but in any case I should measure some low/high egdes on Pin 38
f
Could you try with the standard esp32s3 envelope?
w
Ok, I will try
f
You will see an error, but it shouldn't be fatal
Are you trying to run the on-board led?
I think I just found a similar board in my stash. I will try to run it a bit later.
w
Hi, I switch to the esp32s3 image and found the signal with the scope. I switched back to the esp32s3-spiram-octo image and see now the same signal with the scope. Sorry, my fault. The LED is still not on, but probably it's connected to another pin. The signal on the scope seems to be correct.
f
Good.
w
On my clone board DI is connected to Pin 48. Now the LED works. Thx again!
One more question: Is there a way to find out how much flash is still free? system.serial-print-heap-report give me only RAM/Heap information.
f
Not sure. I'm guessing you are talking about the free flash in the data partition and not the OTA partition. @kasperl might know
w
I don't know in what partion the toit containers are flashed. I just want to know how much of the toit program flash is used (by one container or by all containers) and how much space is left.
k
Toit containers that ship with the base image built from an envelope are put in the OTA partitions.
I think it is possible to extract the information using the Toit tooling.
The other containers, the ones that are dynamically installed over the air, are put in the programs partition: https://github.com/toitlang/toit/blob/master/toolchains/esp32/partitions.csv#L27.
That partition can also contain data.
f
Jaguar uses the
programs
partition.
k
I don't think we have a programatic way of accessing the capacity and used sized of the programs partition. Would not be hard to add though.
Would be nice if Jaguar could log it when you install/uninstall container images.
f
Agreed. I think it would just be an additional method on
FlashRegistry
that sums up the holes: https://github.com/toitlang/toit/blob/master/system/flash/registry.toit#L29 And then the API functions to expose it.