Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix serial issues on 204 and 205 boards (bm1366) #530

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions components/asic/bm1368.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "driver/uart.h"

#include <math.h>
#include <stdint.h>
#include <stdio.h>
Expand Down Expand Up @@ -317,6 +319,10 @@ int BM1368_set_max_baud(void)

unsigned char init8[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x28, 0x11, 0x30, 0x02, 0x00, 0x03};
_send_simple(init8, 11);

// Make sure that we are done writing before setting a new baudrate on the ESP32 controller side.
uart_wait_tx_done(UART_NUM_1, 1000 / portTICK_PERIOD_MS);

return 1000000;
}

Expand Down
6 changes: 6 additions & 0 deletions components/asic/bm1370.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "driver/uart.h"

#include <math.h>
#include <stdint.h>
#include <stdio.h>
Expand Down Expand Up @@ -381,6 +383,10 @@ int BM1370_set_max_baud(void)

unsigned char init8[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x28, 0x11, 0x30, 0x02, 0x00, 0x03};
_send_simple(init8, 11);

// Make sure that we are done writing before setting a new baudrate on the ESP32 controller side.
uart_wait_tx_done(UART_NUM_1, 1000 / portTICK_PERIOD_MS);

return 1000000;
}

Expand Down
5 changes: 5 additions & 0 deletions components/asic/bm1397.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/uart.h"
#include "esp_log.h"

#include "serial.h"
Expand Down Expand Up @@ -322,6 +323,10 @@ int BM1397_set_max_baud(void)
unsigned char baudrate[9] = {0x00, MISC_CONTROL, 0x00, 0x00, 0b01100000, 0b00110001};
; // baudrate - misc_control
_send_BM1397((TYPE_CMD | GROUP_ALL | CMD_WRITE), baudrate, 6, BM1937_SERIALTX_DEBUG);

// Make sure that we are done writing before setting a new baudrate on the ESP32 controller side.
uart_wait_tx_done(UART_NUM_1, 1000 / portTICK_PERIOD_MS);

return 3125000;
}

Expand Down
3 changes: 0 additions & 3 deletions components/asic/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ void SERIAL_set_baud(int baud)
{
ESP_LOGI(TAG, "Changing UART baud to %i", baud);

// Make sure that we are done writing before setting a new baudrate.
uart_wait_tx_done(UART_NUM_1, 1000 / portTICK_PERIOD_MS);

uart_set_baudrate(UART_NUM_1, baud);
}

Expand Down