8338 views|4 replies

2865

Posts

4

Resources
The OP
 

Raspberry Pi Windows IoT Development (V) SPI Interface [Copy link]

Table of contents


Raspberry Pi Windows IoT Development (Part 1)

Raspberry Pi Windows IoT Development (Part 2) USB Camera

Raspberry Pi Windows IoT Development (Part 3) Flashing LED

Raspberry Pi Windows IoT Development (IV) UART Interface

Raspberry Pi Windows IoT Development (V) SPI Interface

The Raspberry Pi has two SPI bus interfaces, SPI0 and SPI1. I have an SD1306 SPI display screen. This screen only uses two SPI lines, SCLK and MOSI, because there is no need to communicate with the screen and therefore no MISO line. In addition to the SPI data line, the CS line (enable), RST line (reset) and CDS line (data/command) are also required. My screen is a little different from the one used by Microsoft, but the functions are compatible. The RST and CDS lines are connected to ordinary GPIO, and CS is connected to the enable line of SPI0.
Hardware: An SD1306 OLED display screen with SPI interface. 7 Dupont lines.
Raspberry Pi development board RPI3B+, HDMI, mouse, USB, power cord, etc.

Data link: ttps://github.com/Microsoft/Windows-iotcore-samples/tree/master/Samples/SPIDisplay

Connect as required

Open the SPIDisplay sample program with VS2019

No need to modify the program, just run it directly.

You can see that the program has been started.

You can see that the text is consistent with the display. Why is it a little "blurry"? This is because the screen has a reverse display, but it is not done well.
The purpose of this article is to introduce the operation of the SPI bus, so the code used is slightly different from the SPIDisplay code.

") rgba(220, 220, 220, 0.5); left: 0px; top: -15px; display: block;">

This is the code for GPIO initialization. Set RST and DCS to GPIO output mode.

") rgba(220, 220, 220, 0.5); left: 0px; top: -15px; display: block;">

There are mainly two steps
1. Define a setting object to set the connection parameters of the peripheral, such as working mode and communication rate
settings.ClockFrequency = 10000000;
settings.Mode = SpiMode.Mode3; No response
2. Select and open the device
string spiAqs = SpiDevice.GetDeviceSelector(SPI_CONTROLLER_NAME);
SpiDisplay = await SpiDevice.FromIdAsync(devicesInfo[0].Id, settings);
SpiDisplay is the defined SPI device object
After the device is ready, you can write data

") rgba(220, 220, 220, 0.5); left: 0px; top: -15px; display: block;">

DtaCommandPin.Write(GpioPinValue.High);//GPIO read and write, set command/data
SpiDisplay.Write(Data);//Write SPI data
Windows iot device operations are asynchronously operated by the driver, so users do not need to worry about multi-task synchronization. This is better than using an embedded operating system. Therefore, programs developed using the Windows iot system are simple and more stable!

This content is originally created by bigbat, a user of EEWORLD forum. If you want to reprint or use it for commercial purposes, you need to obtain the author's consent and indicate the source

This post is from WindowsCE

Latest reply

It is rare to see introductory materials on win iot. The OP did a great job.   Details Published on 2020-2-13 21:08

赞赏

1

查看全部赞赏

 

2865

Posts

4

Resources
2
 

This is the version with pictures. Please delete the version without pictures if you send it.

This post is from WindowsCE

Comments

Okay, let’s study why the previous article was deleted without pictures.  Details Published on 2020-2-12 14:47
 
 
 

9159

Posts

6

Resources
3
 
bigbat posted on 2020-2-12 13:41 This is the version with pictures. Please delete the one without pictures.

Okay, let’s study why the previous article was deleted without pictures.

This post is from WindowsCE
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

1305

Posts

0

Resources
4
 

Not bad. It's also nice to have a small display for human-computer interaction.

This post is from WindowsCE
 
 
 

7422

Posts

2

Resources
5
 

It is rare to see introductory materials on win iot. The OP did a great job.

This post is from WindowsCE
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list