Hi Tomek, On 5/18/23, Tomek CEDRO <to...@cedro.info> wrote: > Hello world :-) > > === Short Story Long === > > I have just created my first custom board configuration based on > ESP32DevkitC. Both application and board configuration is external to > the nuttx.git and nuttx-apps.git (these are git submodules of my > project). > > From what I can see the board definition for ESP32DevkitC is only a > template as it does not define all GPIOs for use. So I have modified > myboard/src/esp32_gpio.c that is creates all /dev/blah entries for > gpio in/out/irq. Why the board definition does not define all GPIO as > devices? Would that interfere with alternate functions assigned to the > pins even on read? > > I have also added ws2812 driver (non SPI one) for LED RGB as part of the > UI. > > I have added gpio and ws2812 example application to test gpio from > nsh. There is a /dev/led_rgb output device created that will drive > WS2812 LED. I can read/write that pin state with gpio application, but > ws2812 application cannot write to that device. Any hints are welcome > here why :-) > > As a remark I can mention that initially that GPIO initialization > caused kernel panic triggered by assertion in the chip gpio code. > Having that assertion helped me figure out that some pins (34..39) > cannot use pull-up/dn that are by default set on gpio irq > initialization. That assertion helped me a lot, thank you! > > What else can I do to trace/debug the ws2812 write problem from the OS > perspective? I cannot really use JTAG pins as they are already used by > some external peripherals on the board. I can work on ESP32DevkitC > with that single example WS2812, but there may be some better way > already out there that would not involve JTAG? > > === Long Story short === > > 1. If I create /dev/gpio0 as GPIO input, and then use that pin for > alternate function would reading /dev/gpio0 interfere with alternate > function? This is important for situations where GPIO configuration is > done at runtime (ie. alternate hardware configuration like GPIO vs > CAN). > > 2. I have /dev/led_rgb set as output that can be successfully > controlled with gpio utility (i.e. set 1 or 0 + readout), but the > ws2812 application (non SPI mode) has problems opening/using that > device (error code -1). Is there any way to tell why opening device > fails? Is it open already by other application for writing? I guess > only one application can have file opened for writing right? > > 3. Is there any way to OS level trace driver development related > problems that would not involve JTAG debug? Something like gdb/kdb > launched from nsh? > > Any hints welcome :-)
I don't think you can get ws2812 working directly using a GPIO over bitbang, the protocol used by this chip is very time sensitive. Actually even in SPI mode I failed to get it working, I tried it on stm32f103-minimum and stm32f4discover because AFAIK originally Brennan implemented and tested the driver in STM32. For GDB debug you will need a ESP-Prog or some OpenOCD compatible JTAG programmer. More info here: https://acassis.wordpress.com/2021/05/12/debugging-esp32-using-openocd-and-gdb/ BR, Alan