From f8eb9be0b6f407e5838797d9c3d859370b9dea90 Mon Sep 17 00:00:00 2001 From: Jeff Piepmeier <14281690+jeffpiep@users.noreply.github.com> Date: Sat, 21 Sep 2024 14:09:30 -0400 Subject: [PATCH] [coco] add force uart baud to s3 --- ...io-fujinet-coco-esp32-s3-wroom-1-n16r8.ini | 6 +++-- ...mio-fujinet-coco-esp32-s3-wroom-1-n8r8.ini | 6 +++-- lib/bus/drivewire/drivewire.cpp | 26 ++++++++++++------- pico/coco/main.c | 2 +- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/build-platforms/platformio-fujinet-coco-esp32-s3-wroom-1-n16r8.ini b/build-platforms/platformio-fujinet-coco-esp32-s3-wroom-1-n16r8.ini index 907f6c4ff..f248b466f 100644 --- a/build-platforms/platformio-fujinet-coco-esp32-s3-wroom-1-n16r8.ini +++ b/build-platforms/platformio-fujinet-coco-esp32-s3-wroom-1-n16r8.ini @@ -4,8 +4,9 @@ build_bus = DRIVEWIRE build_board = fujinet-coco-esp32-s3-wroom-1-n16r8 [env] -upload_port = /dev/ttyACM0 -monitor_port = /dev/ttyACM0 +upload_port = /dev/ttyACM1 +upload_speed = 460800 +monitor_port = /dev/ttyACM1 monitor_speed = 115200 [env:fujinet-coco-esp32-s3-wroom-1-n16r8] @@ -16,3 +17,4 @@ build_type = debug build_flags = ${env.build_flags} -D PINMAP_COCO_ESP32S3 + -D FORCE_UART_BAUD=115200 diff --git a/build-platforms/platformio-fujinet-coco-esp32-s3-wroom-1-n8r8.ini b/build-platforms/platformio-fujinet-coco-esp32-s3-wroom-1-n8r8.ini index 3a1b71452..ecd1de271 100644 --- a/build-platforms/platformio-fujinet-coco-esp32-s3-wroom-1-n8r8.ini +++ b/build-platforms/platformio-fujinet-coco-esp32-s3-wroom-1-n8r8.ini @@ -4,8 +4,9 @@ build_bus = DRIVEWIRE build_board = fujinet-coco-esp32-s3-wroom-1-n8r8 [env] -upload_port = /dev/ttyUSB0 -monitor_port = /dev/ttyUSB0 +upload_port = /dev/ttyACM1 +upload_speed = 460800 +monitor_port = /dev/ttyACM1 monitor_speed = 115200 [env:fujinet-coco-esp32-s3-wroom-1-n8r8] @@ -16,3 +17,4 @@ build_type = debug build_flags = ${env.build_flags} -D PINMAP_COCO_ESP32S3 + -D FORCE_UART_BAUD=115200 diff --git a/lib/bus/drivewire/drivewire.cpp b/lib/bus/drivewire/drivewire.cpp index ff61ecfc7..1cde0f977 100755 --- a/lib/bus/drivewire/drivewire.cpp +++ b/lib/bus/drivewire/drivewire.cpp @@ -997,19 +997,25 @@ void systemBus::setup() // xTaskCreatePinnedToCore(drivewire_intr_task, "drivewire_intr_task", 4096, this, 10, NULL, 0); #ifdef CONFIG_IDF_TARGET_ESP32S3 - // Configure UART to RP2040 - _drivewireBaud = 115200; +// Configure UART to RP2040 +#ifdef FORCE_UART_BAUD + Debug_printv("FORCE_UART_BAUD set to %u", FORCE_UART_BAUD); + _drivewireBaud = FORCE_UART_BAUD; #else - // Setup interrupt for cassette motor pin - gpio_config_t io_conf = { - .pin_bit_mask = (1ULL << PIN_CASS_MOTOR), // bit mask of the pins that you want to set + _drivewireBaud = 115200; +#endif + +#else + // Setup interrupt for cassette motor pin + gpio_config_t io_conf = { + .pin_bit_mask = (1ULL << PIN_CASS_MOTOR), // bit mask of the pins that you want to set .mode = GPIO_MODE_INPUT, // set as input mode .pull_up_en = GPIO_PULLUP_DISABLE, // disable pull-up mode .pull_down_en = GPIO_PULLDOWN_ENABLE, // enable pull-down mode .intr_type = GPIO_INTR_POSEDGE // interrupt on positive edge - }; + }; - _cassetteDev = new drivewireCassette(); + _cassetteDev = new drivewireCassette(); // configure GPIO with the given settings gpio_config(&io_conf); @@ -1028,10 +1034,10 @@ void systemBus::setup() fnSystem.set_pin_mode(PIN_EPROM_A14, gpio_mode_t::GPIO_MODE_INPUT, SystemManager::pull_updown_t::PULL_NONE); fnSystem.set_pin_mode(PIN_EPROM_A15, gpio_mode_t::GPIO_MODE_INPUT, SystemManager::pull_updown_t::PULL_NONE); - #ifdef FORCE_UART_BAUD +#ifdef FORCE_UART_BAUD Debug_printv("FORCE_UART_BAUD set to %u",FORCE_UART_BAUD); _drivewireBaud = FORCE_UART_BAUD; - #else +#else if (fnSystem.digital_read(PIN_EPROM_A14) == DIGI_LOW && fnSystem.digital_read(PIN_EPROM_A15) == DIGI_LOW) { _drivewireBaud = 38400; //Coco1 ROM Image @@ -1053,7 +1059,7 @@ void systemBus::setup() Debug_printv("A14 and A15 High, defaulting to 57600 baud"); } - #endif /* FORCE_UART_BAUD */ +#endif /* FORCE_UART_BAUD */ #endif /* CONFIG_IDF_TARGET_ESP32S3 */ #else // FujiNet-PC specific diff --git a/pico/coco/main.c b/pico/coco/main.c index 1ae1eec29..1d675c0d1 100644 --- a/pico/coco/main.c +++ b/pico/coco/main.c @@ -47,7 +47,7 @@ PIO pioblk_rw = pio1; uint8_t ccc, fff; -#define SERIAL_BAUD 1000000 +#define SERIAL_BAUD 115200 #define PIO_RX_PIN 28 //A2 #define PIO_TX_PIN 29 //A3 void setup_pio_uart()