差别
这里会显示出您选择的修订版和当前版本之间的差别。
后一修订版 | 前一修订版 | ||
spi_verilog [2020/01/15 22:17] gongyu 创建 |
spi_verilog [2022/06/23 15:04] (当前版本) gongyu [SPI slave - HDL FPGA code] |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | ### SPI总线及Verilog实现 | ||
+ | 关于SPI的定义,参见[[SPI]]。 | ||
+ | |||
+ | #### SPI的硬件实现 | ||
+ | |||
+ | #### SPI的软件实现 | ||
+ | |||
SPI 1 - What is SPI? | SPI 1 - What is SPI? | ||
SPI is a simple interface that allows one chip to communicate with one or more other chips. | SPI is a simple interface that allows one chip to communicate with one or more other chips. | ||
行 190: | 行 197: | ||
Now let's see if we can do useful things with SPI. | Now let's see if we can do useful things with SPI. | ||
- | ### SPI 3 - Application | + | #### SPI的应用举例 - 驱动LCD |
- | #### LCD interface | + | |
Since we already know how to drive a graphic LCD panel, in particular in text mode, let's try to write text out from the LPC. | Since we already know how to drive a graphic LCD panel, in particular in text mode, let's try to write text out from the LPC. | ||
From the FPGA point of view, the LCD controller uses a few blockrams to hold the font, characters to display, etc... So we just have to make sure that SPI data gets into the blockrams. | From the FPGA point of view, the LCD controller uses a few blockrams to hold the font, characters to display, etc... So we just have to make sure that SPI data gets into the blockrams. | ||
From the ARM point of view, the function that sends data to the LCD blockrams is called "SSP_WriteBlock". | From the ARM point of view, the function that sends data to the LCD blockrams is called "SSP_WriteBlock". | ||
+ | |||
<code c> | <code c> | ||
// function used to write in the LCD blockrams | // function used to write in the LCD blockrams | ||
行 221: | 行 229: | ||
After configuring the FPGA with the LCD controller, and running the ARM code, here's what we get: | After configuring the FPGA with the LCD controller, and running the ARM code, here's what we get: | ||
- | |||
- | |||
More ideas of projects | More ideas of projects | ||
行 230: | 行 236: | ||
... | ... | ||
Your turn to experiment! | Your turn to experiment! | ||
+ | |||
+ | |||
+ | Github上分享的一个用SPI驱动SSD1306 OLED屏幕的项目参考代码: | ||
+ | * [[spi_master|SPI Master Verilog代码]] | ||
+ | * [[ssd1306_verilog|OLED控制器SSD1306的控制逻辑]] | ||
+ | |||
+ | |||
+ | #### 相关资料 | ||
+ | {{http://ww1.microchip.com/downloads/en/devicedoc/spi.pdf|Microchip关于SPI的PPT}} |