esp-idf debug

Outputting a full log via the serial port when debugging can sometimes be really helpful, because it contains all sorts of state information. idf.py menuconfig In the VS Code “TERMINAL” window, enter: idf.py menuconfig(You may need to use CTRL + ] to end its current mode and get its command prompt first) This will bring […]

Read More

.TWAI general

Documentation https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/twai.html Initialise CAN Bus Handling Alerts You need to check for and handle the TWAI_ALERT_BUS_OFF and TWAI_ALERT_BUS_RECOVERED to protect against the CAN bus ceasing to function if there are bus issues. Polling for alerts twai_read_alerts() uses a ticks_to_wait value, whereby if there is no alert it will wait the specified number of FreeRTOS ticks […]

Read More

CAN bus renamed

Since V4.x release of esp-idf, the can bus peripheral is now called the TWAI (Two-Wire Automotive Interface) by Espressif. It’s still the same peripheral.The can.c etc files were left for backwards compatibility in V4.x esp-idf, and have been removed from V5.x of esp-idf. Various old documentation still exists for CAN, buts it’s the TWAI docs […]

Read More

CS Pin Control

Manually controlling CS pins When adding a SPI device, set its .spics_io_num to -1 Now when you access other device, ensure you set CS low before you use it and high again afterwards

Read More

.Using the SPI Master interface

SPI Pins See the S# series datasheet for the ESP device you are using > Peripheral Pin Configurations Resources https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/spi_master.html SPI Ports on the ESP32 ESP32 C3 ESP32 C3 integrates 3 SPI peripherals. SPI0 and SPI1 Used internally to access the ESP32’s attached flash memory. SPI2 General purpose SPI controller. ESP32 S3 ESP32 S3 integrates […]

Read More

Issues with Programming & Debugging

Where to look for indications of the problem The Espressif troubleshooting page has a good guide (and is what they’ll probably ask you for if you request help) Useful troubleshooting changes you can do in in launch.json JTAG debugging issues we’ve encountered (using ESP-Prog and VSCode) “connect ECONNREFUSED 127.0.0.1:9998” In launch.json, changing mode to auto […]

Read More