Skip to content

Commit

Permalink
[coco] add force uart baud to s3
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffpiep committed Sep 21, 2024
1 parent 06d5c2d commit c9da477
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -16,3 +17,4 @@ build_type = debug
build_flags =
${env.build_flags}
-D PINMAP_COCO_ESP32S3
-D FORCE_UART_BAUD=115200
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -16,3 +17,4 @@ build_type = debug
build_flags =
${env.build_flags}
-D PINMAP_COCO_ESP32S3
-D FORCE_UART_BAUD=115200
26 changes: 16 additions & 10 deletions lib/bus/drivewire/drivewire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,19 +1001,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);
Expand All @@ -1032,10 +1038,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
Expand All @@ -1057,7 +1063,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
Expand Down
2 changes: 1 addition & 1 deletion pico/coco/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit c9da477

Please sign in to comment.