I want to communicate with ESP32 with HCI serial port. For example, through the UART1 of Con1, I want to know that this UART1 corresponds to /dev/ttySx?
if i understand you righ, you want to know the ttyS* device for uart1, right?
see address of uart1 in dtsi:
now you can grep (maybe need -A3) your dmesg for this address (11003000
) to get the right /dev/ttySx
i guess it is ttyS1 as ttyS0 is the debug-uart and devices are enumerated as they defined in dtsi
Hi Frank Thanks for your reply. Now, I found that UART1 is /dev/ttyS1.
And then, I have another question.
I’m trying to integrate the ESP-HOSTED drive, which communicates with the esp32 via SPI, using spi1 to communicate with the esp32. Here I refer to the openwrt/build_dir/target - aarch64_cortex - a53_musl/Linux - mediatek_filogic/Linux - 5.15.79 / drivers/pinctrl/mediatek/pinctrl-mt7986.c
.
I have been modified as follows.
+ spi_esp32_pins: spi-esp32-pins {
+ mux {
+ function = "spi";
+ groups = "spi1_0";
+ };
+ };
+
uart1_pins: uart1-pins {
mux {
function = "uart";
@@ -414,6 +421,13 @@
status = "okay";
};
+&spi1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi_esp32_pins>;
+
+ status = "okay";
+};
+
&ssusb {
vusb33-supply = <®_3p3v>;
vbus-supply = <®_5v>;
After modification, I can see the spi1 node in /sys/class/spi_master/, where there used to be only spi0 node. But if I insmod esp-hosted.ko, it will make kernel crash but nothing to output from debug uart. If I set bus_num to 0, the kernel won’t crash, but it will tell me that I can’t register a new device, like this.
esp_board.mode = SPI_MODE_2;
esp_board.max_speed_hz = spi_clk_mhz * NUMBER_1M;
esp_board.bus_num = 0; // morris was 1
esp_board.chip_select = 0;
master = spi_busnum_to_master(esp_board.bus_num);
if (!master) {
printk(KERN_ERR "Failed to obtain SPI master handle\n");
return -ENODEV;
}
I don’t know what can I do for next, can you give some advice for me?
I’m no expert with spi-bus. Only wonder why you need to add spi1…in mainline there is already the spi1 node.
I use offical openWrt, maybe the repo in local is too old, I will update it and try again.