summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-10-03 16:27:35 +0700
committerhathach <[email protected]>2023-10-03 16:27:35 +0700
commitf36e0b7b923f632fbcc65373d77e0e127f03aace (patch)
tree936f3886feec532398272a4dfd5a5f47c378e48b
parentb394ae1786911a89ea3437d7090cda477ca7df6c (diff)
esp32 comment out uart, increase max3421 spi speed to 26mhz
-rw-r--r--.idea/cmake.xml18
-rw-r--r--hw/bsp/espressif/boards/family.c14
2 files changed, 20 insertions, 12 deletions
diff --git a/.idea/cmake.xml b/.idea/cmake.xml
index c6ebf2a46..9721af5ea 100644
--- a/.idea/cmake.xml
+++ b/.idea/cmake.xml
@@ -9,7 +9,7 @@
</envs>
</ADDITIONAL_GENERATION_ENVIRONMENT>
</configuration>
- <configuration PROFILE_NAME="kaluga" ENABLED="true" TOOLCHAIN_NAME="ESP-IDF" GENERATION_OPTIONS="-DBOARD=espressif_kaluga_1 -DMAX3421_HOST=1 -DLOG=2">
+ <configuration PROFILE_NAME="kaluga" ENABLED="false" TOOLCHAIN_NAME="ESP-IDF" GENERATION_OPTIONS="-DBOARD=espressif_kaluga_1 -DMAX3421_HOST=1 -DLOG=2">
<ADDITIONAL_GENERATION_ENVIRONMENT>
<envs>
<env name="ESPBAUD" value="1500000" />
@@ -54,16 +54,16 @@
<configuration PROFILE_NAME="ra6m5 PORT0" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=ra6m5_ek -DLOG=3 -DLOGGER=RTT -DTRACE_ETM=1 -DPORT=0" />
<configuration PROFILE_NAME="uno_r4" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=uno_r4 -DLOG=4 -DLOGGER=RTT" />
<configuration PROFILE_NAME="portenta_c33" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=portenta_c33 -DLOG=3" />
- <configuration PROFILE_NAME="metro_m4_express" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m4_express -DLOG=3 -DLOGGER=RTT -DMAX3421_HOST=1" />
+ <configuration PROFILE_NAME="metro_m4_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m4_express -DLOG=3 -DLOGGER=RTT -DMAX3421_HOST=1" />
<configuration PROFILE_NAME="metro_m0_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m0_express -DLOG=3 -DLOGGER=RTT -DMAX3421_HOST=1" />
- <configuration PROFILE_NAME="stm32u5" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=stm32u575eval" />
+ <configuration PROFILE_NAME="stm32u5" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=stm32u575eval" />
<configuration PROFILE_NAME="metro esp32s2" ENABLED="false" TOOLCHAIN_NAME="ESP-IDF" GENERATION_OPTIONS="-DBOARD=adafruit_metro_esp32s2 -DMAX3421_HOST=1 -DLOG=2">
- <ADDITIONAL_GENERATION_ENVIRONMENT>
- <envs>
- <env name="ESPBAUD" value="1500000" />
- </envs>
- </ADDITIONAL_GENERATION_ENVIRONMENT>
- </configuration>
+ <ADDITIONAL_GENERATION_ENVIRONMENT>
+ <envs>
+ <env name="ESPBAUD" value="1500000" />
+ </envs>
+ </ADDITIONAL_GENERATION_ENVIRONMENT>
+ </configuration>
</configurations>
</component>
</project> \ No newline at end of file
diff --git a/hw/bsp/espressif/boards/family.c b/hw/bsp/espressif/boards/family.c
index e45765fd1..c6a592627 100644
--- a/hw/bsp/espressif/boards/family.c
+++ b/hw/bsp/espressif/boards/family.c
@@ -41,6 +41,8 @@
#include "driver/periph_ctrl.h"
#endif
+// Note; current code use UART0 can cause device to reset while monitoring
+#define USE_UART 0
#define UART_ID UART_NUM_0
#ifdef NEOPIXEL_PIN
@@ -61,6 +63,7 @@ static void configure_pins(usb_hal_context_t *usb);
// Initialize on-board peripherals : led, button, uart and USB
void board_init(void) {
+#if USE_UART
// uart init
uart_config_t uart_config = {
.baud_rate = 115200,
@@ -71,6 +74,7 @@ void board_init(void) {
};
uart_driver_install(UART_ID, 1024, 0, 0, NULL, 0);
uart_param_config(UART_ID, &uart_config);
+#endif
#ifdef NEOPIXEL_PIN
#ifdef NEOPIXEL_POWER_PIN
@@ -157,7 +161,11 @@ uint32_t board_button_read(void) {
// Get characters from UART
int board_uart_read(uint8_t *buf, int len) {
+#if USE_UART
return uart_read_bytes(UART_ID, buf, len, 0);
+#else
+ return -1;
+#endif
}
// Send characters to UART
@@ -168,8 +176,8 @@ int board_uart_write(void const *buf, int len) {
}
int board_getchar(void) {
- char c;
- return (uart_read_bytes(UART_ID, &c, 1, 0) > 0) ? (int) c : (-1);
+ uint8_t c = 0;
+ return board_uart_read(&c, 1) > 0 ? (int) c : (-1);
}
//--------------------------------------------------------------------+
@@ -224,7 +232,7 @@ static void max3421_init(void) {
spi_device_interface_config_t max3421_cfg = {
.mode = 0,
- .clock_speed_hz = 4000000, // 26000000
+ .clock_speed_hz = 26000000,
.spics_io_num = -1, // manual control CS
.queue_size = 1
};