Hifive 1 Rev B interfacing with ESP32-SOLO-1

I am trying to interact with ESP32 on the Hifive1 rev b, as stated in the Getting Started document the FE310 and ESP32 shows up as ttyACM0 and ttyACM1 respectively.
But I am not able to interact with it with serial connection.

ATE0–>ATE0
OK
AT+BLEINIT=0–>OK
AT+CWMODE=0–>OK

this is the output form *ACM0.
This turns out to be factory flashed.
Any Idea as to how to Proceed?

ESP32 is connected to FE310 via SPI, so you need to use SPI to communicate. There is a non-trivial protocol on top of SPI. You can learn by understanding the other side of this protocol: https://github.com/espressif/esp32-at/blob/master/main/interface/hspi/at_hspi_task.c
I implemented this protocol in Rust, but it doesn’t work properly at the moment due to the startup CS glitches: https://github.com/riscv-rust/riscv-rust-quickstart/blob/master/examples/spi_wifi.rs

But the ESP32 is also connected to UART1 at least for AT commands. How did you discover this protocol?

As far as I understand, ESP32 is connected with UART to JLink chip, not to FE310.
I discovered this protocol with logic analyzer and by googling some messages from that ESP32 UART output.

I was able to serial read Data form ttyACM1 using gtkterm. This appears to be form the ESP Chip. But I am not able to send in any AT commands to ESP.

I am not very experienced with this. Pls advice.

This is just a debug log ESP32 writes to UART connected to the JLink chip. You need to use SPI on FE310 to send AT commands.

1 Like

I understand, but how do i know which pins to use?
I am using the metal/spi.h library in VScode with PlatformIO Integration. The example uses a device_num as an argument to create a handle for SPI.
Which environment do you suggest, as I am not very proficient with Rust.

I understand, but how do i know which pins to use?

From the board schematics. You can learn that ESP32 shares SPI1 pins and has two additional signals: WF_INT (GPIO 10) and SPI_CS2 (GPIO 9). The former is used as a “handshake” signal from ESP32 to FE310, the latter (as its name says) should be used as a hardware-controlled CS signal.

Which environment do you suggest, as I am not very proficient with Rust.

I have a somewhat biased opinion, but I think that Rust environment supports this board better than the other ones. Embedded Rust itself is more difficult for beginners, but there are several books to start with.

Does this mean that the Hifive1 Rev B uses the SPI2 instance?
I checked the schematics and couldn’t find the CS1? why is that?
And finally is there any memory that is available or that can be supplied so that the esp32 pulls instructions from the memory.
Thanks.

No, ESP32 is connected to the SPI1 instance.
There is no CS1 because it is not routed to the QFN48 package leads.
IIRC, this ESP32 module has its own memory and its own firmware, so you can change it according to your needs. However, you should consider existing board connections and the fact that FE310 bootloader communicates with ESP32 and it will not execute the firmware without proper communication.

OKAY, I will check it out.Thank you so much @Disasm

Yes, of course you are free to reprogram the ESP32 as you wish (it’s your board!) but as @Disasm points out the FE310 “bootloader” expects it to respond to a few simple AT commands.

I would expect 99% of people would want to leave the factory programming in the ESP32 and just use it for WIFI and BlueTooth communications using the software already loaded in it.

It would be great to see the source for the HiFive1B bootloader similar to what was posted for the HiFive1 double-tap bootloader discussed in this thread Bootloader restore.

If there are expectations that the HiFive1B bootloader is making with respect to what is running on the ESP32, I would like to see that.

Honestly, I was confused seeing ESP32 spew coming from the UART that is connected to the FE310 on the HiFive1B, but it must be the 1B bootloader mirroring the AT cmd/resp with ESP32. Seeing how the bootloader is setting up and making that communication with the ESP32 would go a long way in clearing up what is going on on the FE310 prior to any program that starts execution at 0x20010000

Not everything the FE310 chip can do is accessible on the Hifive1B board, just due to lack of space in the Arduino form factor. You have to examine the schematic diagram carefully, as well as the pinout picture at the end of the Getting Started document. Here are some things I have found:

There are two UARTs in the FE310, and both are available as board pin headers, but only UART0 is connected through the JLink chip to the USB, where it appears as /dev/ttyACM0.

There are three SPI controllers, but SPI0 is dedicated to interfacing to the Flash memory, and SPI2 is not connected to anything at all. SPI1 is available on the pin headers and is also directly wired to the ESP32. Each SPI controller can theoretically control 4 chip-select lines, but only 3 are actually available on SPI1, and one of those is dedicated to the ESP32.

The JLink chip seems to be quite complicated, and it is three times the physical size of the actual FE310 CPU!

Thanks for all the help. I am new to this, so I am figuring things out slowly.

Fix: two CS pins are used by the ESP32 part, only one of them is actually used as a CS line.

Hi,

According to the schematics, Handshake pin is GPIO 10 and Chip Select is GPIO 9.

I managed to talk to the ESP32-SOLO1 module via SPI1, by enabling CSMODE=CS_AUTO and CSID=2 to get the chip-select pin automatically toggled high / low.

See this post: SPI Hifive 1 Rev B
… and complete code here: https://github.com/kjarvel/hifive1revb_wifi

Feel free to use, I hope you find this useful!