Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Epler jepler

View GitHub Profile
View idf-twai-optimization.txt
twai_self_test failure with CONFIG_COMPILER_OPTIMIZATION_SIZE=y
Software version used: esp-idf v4.3-dev-1561-g357a27760
(problem also affects v4.2-dev-2968-g8bc19ba89 (circuitpython 6.0.0-rc.0))
Hardware used: ESP32-S2-Kaluga-1
Teseting procedure:
1. Prepare hardware: Install jumper wire between pins 17 and 18.
2. Build working configuration:
View twai-self-test-instrumentation.patch
diff --git a/examples/peripherals/twai/twai_self_test/main/Kconfig.projbuild b/examples/peripherals/twai/twai_self_test/main/Kconfig.projbuild
index 125931f16..25b1f306f 100644
--- a/examples/peripherals/twai/twai_self_test/main/Kconfig.projbuild
+++ b/examples/peripherals/twai/twai_self_test/main/Kconfig.projbuild
@@ -2,7 +2,7 @@ menu "Example Configuration"
config EXAMPLE_TX_GPIO_NUM
int "TX GPIO number"
- default 20 if IDF_TARGET_ESP32S2
+ default 17 if IDF_TARGET_ESP32S2
View gist:d2a148b18ac233ec81017022a3dfe374
--- /dev/fd/63 2020-10-22 16:31:22.758725842 -0500
+++ /dev/fd/62 2020-10-22 16:31:22.758725842 -0500
@@ -16,29 +16,45 @@
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y
CONFIG_BOOTLOADER_WDT_ENABLE=y
CONFIG_BOOTLOADER_WDT_TIME_MS=9000
-CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
-CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y
-CONFIG_COMPILER_OPTIMIZATION_SIZE=y
+CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1
View sdkconfig
#
# Automatically generated file. DO NOT EDIT.
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
#
CONFIG_IDF_CMAKE=y
CONFIG_IDF_TARGET="esp32s2"
CONFIG_IDF_TARGET_ESP32S2=y
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0002
#
View Excerpt from WIP CircuitPython CAN.c
esp_err_t result = twai_driver_install(&self->g_config, &self->t_config, &self->f_config);
if (result == ESP_ERR_NO_MEM) {
mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed"));
} else if (result == ESP_ERR_INVALID_ARG) {
mp_raise_ValueError(translate("Invalid pins"));
} else if (result != ESP_OK) {
mp_raise_OSError_msg_varg(translate("twai_driver_install returned esp-idf error #%d"), (int)result);
}
mp_printf(&mp_plat_print, "f_config.acceptance_code = 0x%08x\n", self->f_config.acceptance_code);
View can_rcvr.py
import ulab
import sys
import struct
import time
import neopixel_write
import board
import digitalio
neopixel = digitalio.DigitalInOut(board.NEOPIXEL)
View cantoo.ino
#include <string.h>
#include <Adafruit_ZeroCAN.h>
Adafruit_ZeroCAN can{};
void setup() {
Serial.begin(9600); // open the serial port at 9600 bps:
digitalWrite(PIN_CAN_STANDBY, false); // turn off STANDBY
can.begin(1000000, true, false);
View cannot.ino
#include "wiring_private.h"
#include <sam.h>
#include <component/can.h>
#include <component/gclk.h>
#include <instance/can0.h>
#include <instance/gclk.h>
#define GCLK_CAN GCLK_PCHCTRL_GEN_GCLK1_Val
#define FREQ VARIANT_GCLK1_FREQ
View errors.txt
Arduino: 1.8.13 (Linux), Board: "Adafruit Feather M4 CAN (SAMD51), Enabled, 120 MHz (standard), Small (-Os) (standard), 50 MHz (standard), Arduino, Off"
View can_rxtx.py
import struct
import time
import board
import digitalio
class Deadline:
def __init__(self, relative=None, relative_ns=None):
self.deadline = time.monotonic_ns()
self.reset(relative, relative_ns)
You can’t perform that action at this time.