esp32 comment out uart, increase max3421 spi speed to 26mhz

This commit is contained in:
hathach 2023-10-03 16:27:35 +07:00
parent b394ae1786
commit f36e0b7b92
No known key found for this signature in database
GPG Key ID: F5D50C6D51D17CBA
2 changed files with 20 additions and 12 deletions

18
.idea/cmake.xml generated
View File

@ -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>

View File

@ -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
};