SPI Hifive 1 Rev B

I created a HiFive1 Rev B WiFi example here: https://github.com/kjarvel/hifive1revb_wifi

Note:

  • The code is generic C, using the registers from the Freedom E310-G002 Manual, not using the metal library.
  • The modules are sort of stand-alone, include cpu.h or uart.h to use them (except spi.c that requires all the others).
  • The code is sort of test code with no error handling, just to be simple (please be kind :wink: ).

The application enables 320 Mhz clock speed for the CPU, and 115200 bps for UART.
SPI1 communication speed is set to 80 kHz (can be changed).

Connect to the UART using for example Tera Term or PuTTY, enter the SSID and password of the AP you want to connect to, see the screenshot here:
(Press the reset button on the board until you see the initial AT+CWMODE=0-->OK message).

After disconnecting, you can enter extra AT commands.

To get this working:

  • Thanks to @Disasm for all the helpful hints!
  • I used a logic analyzer to get this to work, looking at the AT+CWMODE=0 commands sent by the default firmware (hifive_revb_bootloader).
  • The trick was to enable SPI1_CSMODE = CS_AUTO and SPI1_CSID = 2 to get the CS pin high / low.
  • Listening on the Handshake pin was also important…
  • Note that the code ignores any replies from the ESP32 (and does not ask for replies).