proj: switching to ESP32C6
This commit is contained in:
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "ESP-IDF",
|
"name": "ESP-IDF",
|
||||||
"compilerPath": "${config:idf.toolsPathWin}\\tools\\xtensa-esp-elf\\esp-13.2.0_20240530\\xtensa-esp-elf\\bin\\xtensa-esp32-elf-gcc.exe",
|
"compilerPath": "${config:idf.toolsPathWin}\\tools\\riscv32-esp-elf\\esp-13.2.0_20240530\\riscv32-esp-elf\\bin\\riscv32-esp-elf-gcc.exe",
|
||||||
"compileCommands": "${config:idf.buildPath}/compile_commands.json",
|
"compileCommands": "${config:idf.buildPath}/compile_commands.json",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${config:idf.espIdfPath}/components/**",
|
"${config:idf.espIdfPath}/components/**",
|
||||||
|
|||||||
Vendored
+2
-2
@@ -11,9 +11,9 @@
|
|||||||
},
|
},
|
||||||
"idf.espIdfPathWin": "C:\\Tools\\ESP-IDF\\v5.3\\esp-idf",
|
"idf.espIdfPathWin": "C:\\Tools\\ESP-IDF\\v5.3\\esp-idf",
|
||||||
"idf.openOcdConfigs": [
|
"idf.openOcdConfigs": [
|
||||||
"board/esp32-wrover-kit-3.3v.cfg"
|
"board/esp32c6-builtin.cfg"
|
||||||
],
|
],
|
||||||
"idf.portWin": "COM4",
|
"idf.portWin": "COM9",
|
||||||
"idf.pythonBinPathWin": "C:\\Tools\\ESP\\python_env\\idf5.3_py3.11_env\\Scripts\\python.exe",
|
"idf.pythonBinPathWin": "C:\\Tools\\ESP\\python_env\\idf5.3_py3.11_env\\Scripts\\python.exe",
|
||||||
"idf.toolsPathWin": "C:\\Tools\\ESP",
|
"idf.toolsPathWin": "C:\\Tools\\ESP",
|
||||||
"idf.flashType": "UART",
|
"idf.flashType": "UART",
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ class StepperMotor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void demoFullTurn() {
|
void demoFullTurn() {
|
||||||
auto steps = _config.resolution * _config.steps;
|
|
||||||
ESP_LOGI("Stepper", "Running %i * %i steps for full turn", _config.resolution, _config.steps);
|
ESP_LOGI("Stepper", "Running %i * %i steps for full turn", _config.resolution, _config.steps);
|
||||||
|
|
||||||
ESP_LOGI("Stepper", "Start is %f.2", getScaledPos());
|
ESP_LOGI("Stepper", "Start is %f.2", getScaledPos());
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ PwmPort::PwmPort(ledc_timer_t timer, ledc_channel_t channel, gpio_num_t output,
|
|||||||
.duty_resolution = resolution,
|
.duty_resolution = resolution,
|
||||||
.timer_num = timer,
|
.timer_num = timer,
|
||||||
.freq_hz = frequency,
|
.freq_hz = frequency,
|
||||||
.clk_cfg = LEDC_AUTO_CLK,
|
.clk_cfg = LEDC_AUTO_CLK
|
||||||
};
|
};
|
||||||
ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer));
|
ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer));
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ StepperDriverDrv8833::StepperDriverDrv8833(Pins pins, int resolution)
|
|||||||
|
|
||||||
populateLookUps(resolution, _outA1, _outA2, _outB1, _outB2);
|
populateLookUps(resolution, _outA1, _outA2, _outB1, _outB2);
|
||||||
|
|
||||||
char buffer[resolution * 2 + 10];
|
|
||||||
ESP_LOGD("Stepper", "Output Data:");
|
ESP_LOGD("Stepper", "Output Data:");
|
||||||
ESP_LOG_BUFFER_HEXDUMP("Stepper", _outA1.data(), _outA1.size(), ESP_LOG_DEBUG);
|
ESP_LOG_BUFFER_HEXDUMP("Stepper", _outA1.data(), _outA1.size(), ESP_LOG_DEBUG);
|
||||||
ESP_LOG_BUFFER_HEXDUMP("Stepper", _outA2.data(), _outA2.size(), ESP_LOG_DEBUG);
|
ESP_LOG_BUFFER_HEXDUMP("Stepper", _outA2.data(), _outA2.size(), ESP_LOG_DEBUG);
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class ProfileGenerator {
|
|||||||
Profile createRapidStartSwingInEnd(float delta) {
|
Profile createRapidStartSwingInEnd(float delta) {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
auto pnt = getStopDistance(_aMax, _wMax);
|
|
||||||
auto wMax = _wMax;
|
auto wMax = _wMax;
|
||||||
// t0..t1: acceleration to max velocity
|
// t0..t1: acceleration to max velocity
|
||||||
accelUntil(_aMax * 2, 0, [wMax](Point pnt) { return pnt.w > (wMax * 2); });
|
accelUntil(_aMax * 2, 0, [wMax](Point pnt) { return pnt.w > (wMax * 2); });
|
||||||
@@ -159,7 +158,7 @@ class ProfileGenerator {
|
|||||||
t = t + _dT;
|
t = t + _dT;
|
||||||
float env = a * t;
|
float env = a * t;
|
||||||
float p = std::sin(sTau * t / TwMax) * env * TwMax / sTau;
|
float p = std::sin(sTau * t / TwMax) * env * TwMax / sTau;
|
||||||
float w = (p - _pVec.back()) / _dT;
|
float w = (p - pX) / _dT;
|
||||||
if (w > _wMax) {
|
if (w > _wMax) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -11,5 +11,5 @@ dependencies:
|
|||||||
type: idf
|
type: idf
|
||||||
version: 5.3.0
|
version: 5.3.0
|
||||||
manifest_hash: 98a89ad95a9bf328a52537968b9e16f59396acd948940746898355de27de317f
|
manifest_hash: 98a89ad95a9bf328a52537968b9e16f59396acd948940746898355de27de317f
|
||||||
target: esp32
|
target: esp32c6
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
|
|||||||
+29
-27
@@ -117,28 +117,33 @@ void LightingTask() {
|
|||||||
ESP_LOGI(TAG, "Start Lighting");
|
ESP_LOGI(TAG, "Start Lighting");
|
||||||
|
|
||||||
static I2cMaster master(I2C_NUM_0,
|
static I2cMaster master(I2C_NUM_0,
|
||||||
/*sda=*/ GPIO_NUM_0,
|
/*sda=*/ GPIO_NUM_10,
|
||||||
/*scl=*/ GPIO_NUM_4);
|
/*scl=*/ GPIO_NUM_11);
|
||||||
// static PmwExpanderPca9685 pca9685(master);
|
// static PmwExpanderPca9685 pca9685(master);
|
||||||
static PmwExpanderPca9685 ledDriver1(master, /*iverted=*/ true);
|
static PmwExpanderPca9685 ledDriver1(master, /*iverted=*/ false);
|
||||||
static PmwExpanderPca9685 ledDriver2(master, /*iverted=*/ true, 0x41);
|
static PmwExpanderPca9685 ledDriver2(master, /*iverted=*/ false, 0x41);
|
||||||
PmwExpanderPca9685::GrayValues values[2];
|
PmwExpanderPca9685::GrayValues values[2];
|
||||||
|
|
||||||
while (true) {
|
OutputPort pwmEnable(GPIO_NUM_5, GpioPort::Logic::Inverted);
|
||||||
ESP_LOGI("Light", "Tick");
|
pwmEnable.write(true);
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
|
while (true) {
|
||||||
values[0].fill(0);
|
values[0].fill(0);
|
||||||
values[1].fill(0);
|
values[1].fill(0);
|
||||||
|
|
||||||
values[0][12] = 0x100;
|
// values[x][4] = 0x200; // Actually first
|
||||||
values[0][15] = 0x100;
|
values[0][idx] = 0x200;
|
||||||
ledDriver1.sendImage(values[0]);
|
ledDriver1.sendImage(values[0]);
|
||||||
|
|
||||||
values[1][1] = 0x100;
|
// values[1][4] = 0x100; // Actually first
|
||||||
values[1][2] = 0x100;
|
values[1][idx] = 0x400;
|
||||||
ledDriver2.sendImage(values[1]);
|
ledDriver2.sendImage(values[1]);
|
||||||
|
|
||||||
fos::Task::delayMs(1000);
|
if (++idx >= 16 ) {
|
||||||
|
idx = 0;
|
||||||
|
}
|
||||||
|
fos::Task::delayMs(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,14 +153,20 @@ void MovementTask() {
|
|||||||
StepperDriverDrv8833::Pins stepperPins{
|
StepperDriverDrv8833::Pins stepperPins{
|
||||||
LEDC_TIMER_0,
|
LEDC_TIMER_0,
|
||||||
{LEDC_CHANNEL_0, LEDC_CHANNEL_1, LEDC_CHANNEL_2, LEDC_CHANNEL_3},
|
{LEDC_CHANNEL_0, LEDC_CHANNEL_1, LEDC_CHANNEL_2, LEDC_CHANNEL_3},
|
||||||
{GPIO_NUM_16, GPIO_NUM_15, GPIO_NUM_14, GPIO_NUM_13},
|
{GPIO_NUM_23, GPIO_NUM_22, GPIO_NUM_21, GPIO_NUM_20},
|
||||||
};
|
};
|
||||||
StepperDriverDrv8833 stepperDriver(stepperPins, MicroSteps);
|
StepperDriverDrv8833 stepperDriver(stepperPins, MicroSteps);
|
||||||
stepperDriver.setPos(0);
|
stepperDriver.setPos(0);
|
||||||
|
|
||||||
StepperMotor::Config stepperCfg{1.8F, MicroSteps};
|
StepperMotor::Config stepperCfg{1.8F, MicroSteps};
|
||||||
InputPort initSens(GPIO_NUM_33);
|
InputPort initSens(GPIO_NUM_18);
|
||||||
initSens.setLogic(GpioPort::Logic::Inverted);
|
|
||||||
|
InputPort motorFault(GPIO_NUM_8);
|
||||||
|
motorFault.setLogic(GpioPort::Logic::Inverted);
|
||||||
|
|
||||||
|
OutputPort motorSleep(GPIO_NUM_15, GpioPort::Logic::Inverted);
|
||||||
|
motorSleep.write(false);
|
||||||
|
|
||||||
StepperMotor stepper(stepperCfg, stepperDriver, initSens);
|
StepperMotor stepper(stepperCfg, stepperDriver, initSens);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -178,20 +189,12 @@ void MovementTask() {
|
|||||||
void IoTest()
|
void IoTest()
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "Start IO");
|
ESP_LOGI(TAG, "Start IO");
|
||||||
InputPort in2(GPIO_NUM_32);
|
InputPort in2(GPIO_NUM_19);
|
||||||
InputPort mFault(GPIO_NUM_35);
|
OutputPort nReset(GPIO_NUM_9);
|
||||||
|
|
||||||
OutputPort nEnable(GPIO_NUM_2);
|
|
||||||
OutputPort nReset(GPIO_NUM_5);
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
ESP_LOGI("Light", "InValues %i %i", in2.read(), mFault.read());
|
nReset.write(in2.read());
|
||||||
nEnable.write(true);
|
fos::Task::delayMs(100);
|
||||||
nReset.write(true);
|
|
||||||
fos::Task::delayMs(500);
|
|
||||||
nEnable.write(false);
|
|
||||||
nReset.write(false);
|
|
||||||
fos::Task::delayMs(500);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +206,6 @@ void app_main(void)
|
|||||||
ret = nvs_flash_init();
|
ret = nvs_flash_init();
|
||||||
}
|
}
|
||||||
ESP_ERROR_CHECK(ret);
|
ESP_ERROR_CHECK(ret);
|
||||||
// ESP_ERROR_CHECK(esp_event_loop_create_default());
|
|
||||||
initialize_ethernet();
|
initialize_ethernet();
|
||||||
static fos::Task lightingTask(LightingTask, "Lights", 0x4000uL);
|
static fos::Task lightingTask(LightingTask, "Lights", 0x4000uL);
|
||||||
static fos::Task movementTask(MovementTask, "Motor", 0x4000uL);
|
static fos::Task movementTask(MovementTask, "Motor", 0x4000uL);
|
||||||
|
|||||||
-2021
File diff suppressed because it is too large
Load Diff
+22
-12
@@ -1,25 +1,35 @@
|
|||||||
#
|
#
|
||||||
# Example Ethernet Configuration
|
# Example Ethernet Configuration
|
||||||
#
|
#
|
||||||
# CONFIG_ETH_USE_SPI_ETHERNET is not set
|
CONFIG_EXAMPLE_USE_SPI_ETHERNET=y
|
||||||
|
CONFIG_EXAMPLE_SPI_ETHERNETS_NUM=1
|
||||||
CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y
|
# CONFIG_EXAMPLE_USE_DM9051 is not set
|
||||||
CONFIG_EXAMPLE_ETH_PHY_LAN87XX=y
|
# CONFIG_EXAMPLE_USE_KSZ8851SNL is not set
|
||||||
CONFIG_EXAMPLE_ETH_MDC_GPIO=23
|
CONFIG_EXAMPLE_USE_W5500=y
|
||||||
CONFIG_EXAMPLE_ETH_MDIO_GPIO=18
|
CONFIG_EXAMPLE_ETH_SPI_HOST=1
|
||||||
CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=12
|
CONFIG_EXAMPLE_ETH_SPI_SCLK_GPIO=6
|
||||||
CONFIG_EXAMPLE_ETH_PHY_ADDR=0
|
CONFIG_EXAMPLE_ETH_SPI_MOSI_GPIO=7
|
||||||
# CONFIG_EXAMPLE_USE_SPI_ETHERNET is not set
|
CONFIG_EXAMPLE_ETH_SPI_MISO_GPIO=2
|
||||||
|
CONFIG_EXAMPLE_ETH_SPI_CLOCK_MHZ=16
|
||||||
|
CONFIG_EXAMPLE_ETH_SPI_CS0_GPIO=3
|
||||||
|
CONFIG_EXAMPLE_ETH_SPI_INT0_GPIO=4
|
||||||
|
CONFIG_EXAMPLE_ETH_SPI_POLLING0_MS=0
|
||||||
|
CONFIG_EXAMPLE_ETH_SPI_PHY_RST0_GPIO=-1
|
||||||
|
CONFIG_EXAMPLE_ETH_SPI_PHY_ADDR0=1
|
||||||
# end of Example Ethernet Configuration
|
# end of Example Ethernet Configuration
|
||||||
|
|
||||||
#
|
#
|
||||||
# Ethernet
|
# Ethernet
|
||||||
#
|
#
|
||||||
# CONFIG_ETH_RMII_CLK_INPUT is not set
|
# CONFIG_ETH_SPI_ETHERNET_W5500 is not set
|
||||||
CONFIG_ETH_RMII_CLK_OUTPUT=y
|
|
||||||
# CONFIG_ETH_RMII_CLK_OUTPUT_GPIO0 is not set
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Wi-Fi
|
# Wi-Fi
|
||||||
#
|
#
|
||||||
# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set
|
# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# Serial flasher config
|
||||||
|
#
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE="8MB"
|
||||||
|
|||||||
Reference in New Issue
Block a user