{{pfw:banner.png}} ====== SPI protocol for the GD32VF103 ====== * [[en:pfw:spi_gd32vf_noforth_bbspi_v100.f|Bitbang on port-A]] Note that the highlevel generates a 300 kHz clock, the low level variant a 1 MHz clock. The bitbang SPI setup has no restrictions at all. More on I/O-ports from page 101ff of the user manual mentioned below. * [[en:pfw:spi_gd32vf_noforth_spi0_v100.f|Hardware SPI on port-A]] The upper limit of the SPI clock of the GD32 is 27 MHz, so always check your settings. With noForth you may add the SPI setup routine to the APP vector. **The first version of SPI-setup did not initialise the NSS pin, thanks to Martin Bitter & Wolfgang Strauss this is corrected.** More on SPI from page 377ff of the user manual. {{https://user-images.githubusercontent.com/11397265/120066830-9a2a3d00-c078-11eb-8c5e-d7b48160e945.jpg|Inlezen een karakter in noForth}} **Read a character using SPI from a W25Q64 external Flash memory** ==== Two examples ==== ^File name ^Commands ^Purpose ^ |[[en:pfw:spi_gd32vf_noforth_spi-loopback.f|SPI-loopback.f]] |''%%COUNTER%%'' |A counter as simplest loopback test | |[[en:pfw:spi_gd32vf_noforth_flash_driver_gd32.f|Flash driver GD32.f]] |''%%SPI-ON%%'' |Activate SPI-interface to W25Q64 Flash memory chip | | |''%%FILL1 0 write-sector%%''|Fill buffer with pattern en write to Flash sector 0 | | |''%%0 100 FDUMP%%'' |Dump sector 0 showing the written contents, etc. | |[[en:pfw:spi_gd32vf_noforth_spi_oled_display_gd32.f|SPI OLED display GD32.f]]|''%%DEMO%%'' |Initialise OLED & display P-F-W until a key is hit | | |''%%&PAGE%%'' |Erases the OLED and sets the cursor in upper left corner| {{https://user-images.githubusercontent.com/11397265/120901097-fffa6400-c638-11eb-9777-d6ff3f77e155.png|afbeelding}}\\ **NOF filesystem on SPI Flash initialised while booting the GD32VF103** ==== More information on the GD32VF103 ==== * [[http://gd32mcu.com/download/down/document_id/221/path_type/1|Datasheet]], GD32VF103 Datasheet Rev 1.3.pdf\\ * [[http://gd32mcu.com/download/down/document_id/222/path_type/1|User manual]], GD32VF103 User Manual EN V1.2.pdf