当前位置:网站首页>Stm32mp1 cortex M4 development part 10: expansion board nixie tube control

Stm32mp1 cortex M4 development part 10: expansion board nixie tube control

2022-06-21 09:13:00 Huaqing vision it open laboratory

Write it at the front :

This article is 《ARM Cortex-M4 Bare metal development 》 One in a series ,, The total of the series 14 piece . The development platform used by the author is Huaqing vision FS-MP1A Development board (STM32MP157 Development board ),Cortex-M4 In addition to talking about bare metal development M4 Outside bare metal development , Will also explain through M4 Control various sensor actuator modules on the resource expansion board ( Including air temperature and humidity sensor 、LED The lamp 、 Nixie tube 、 Buzzer 、 Vibration motor 、 Key interrupt 、 Fans, etc ), This is M4 An article in the control resource expansion board .

The resource expansion board is FS-MP1A Expansion module of development board , Mainly consists of 10 More than one kind of auxiliary mainstream sensor 、 Executive device 、 Bus control device , Very convenient for project expansion . It can expand and develop smart families 、 Intelligent medical treatment 、 Intelligent security 、 Industrial control 、 Image recognition 、 Environmental detection, etc 10 About comprehensive projects , Huaqing vision development board will also provide supporting documentation for all projects 、 Experiment source code 、 Applications and other information .

in the light of FS-MP1A Development board , except Cortex-M4 Bare metal development , There are also many other series of tutorials , Include Cortex-A7 Development of article 、FreeRTOS piece 、Linux Foundation and application development 、Linux System transplantation 、Linux Driving development 、 Hardware design 、 Artificial intelligence machine vision 、Qt Application programming 、Qt Comprehensive project practice, etc . Welcome to your attention , more stm32mp157 Develop tutorials and videos , Technical exchange can be added Q Group 459754978, Thank you for attention .

FS-MP1A Development board details : TaoBao - Amoy ! I like

Catalog

1. Introduction to resource expansion board

1.1 Hardware introduction

1.2 Resource expansion board developable project

2. Expansion board nixie tube control

2.1. Experimental principle

2.3. Experimental environment

2.4. The experimental steps


1. Introduction to resource expansion board

1.1 Hardware introduction

1.2 Resource expansion board developable project

2. Expansion board nixie tube control

2.1. Experimental principle

Open the schematic diagram of the expansion board. By comparing the expansion board, you can see the schematic diagram of the four digit nixie tube on the expansion board as follows :

From the figure, it can be determined that the digital tube is a common cathode digital tube ,DS_A、DS_B、DS_C、DS_D、DS_E、DS_F、DS_G、DS_DP Corresponding to each segment of the nixie tube , When the corresponding pin is high, the corresponding part will be charged , Because there is only one set of data signals , But there are four digital tubes , So we need to control DS_G1、DS_G2、DS_G3 and DS_G4 Select a certain nixie tube to display content , Then the four nixie tubes are displayed normally by polling and refreshing .

M74HC595 Is an in and out shift register , If there are multiple chips cascaded, the serial output can also control the next chip ,QA~QH For parallel output ,QH’ Serial output ; If this example has four LED The nixie tube consists of two M74HC595 control , The first level controls what the nixie tube displays , The second level controls which nixie tube displays .

According to the above description, the driver can be written through GPIO simulation 74HC595 Complete control of the clock , because 74H595 Timing sum SPI Timing compatibility , So you can also use SPI Controller control 74HC595.

74H595 Partial timing

SPI sequential (CPHA=0 CPOL=0)

Comparison diagram of interface between expansion board and backplane

Check out the chip manual , The corresponding relationship of pins is as follows :

2.2. The experiment purpose

understand M74HC595 shift register

Study SPI How to use the protocol , Master how to use STM32MP157A Chip controlled display nixie tube

2.3. Experimental environment

FS-MP1A Development platform

ST-Link Emulator

STM32CubeIDE Development software

PC machine XP、Window7/10 (32/64bit)

2.4. The experimental steps

open STM32CubeIDE, To configure CubeMX.

according to 21.1 section , It uses SPI Default pin , Respectively for PE11、PE12、PE13 and PE14 Configure to SPI_NSS、SPI_SCK、SPI_MISO and SPI_MOSI. Switch to SPI4 label , Check as “M4”,“Mode” choice “Full-Duplex-Master”, Use hardware chip selection , choice “Hardware NSS Output Signal”, Its configuration is shown in the figure below .

The above is the configuration process of new projects , May refer to 12.3.2 Chapter to import the existing project , Project storage path 【 Huaqing vision -FS-MP1A Development of information \02- Program source code \ARM Architecture and interface technology \Cortex-M4\9_EX_SPI_NUMBER】

Code design

The hardware used this time SPI, You don't need to write your own program to realize SPI sequential , All you need to do is call HAL Provided SPI Hardware operation function , among , call “HAL_SPI_Transmit” Function to send data from the master to the slave , establish driver_sm74hc.c file , In the document to achieve the control code of the nixie tube is as follows .

void M74HC595_ReadDataTest(void)

{

rw_595_Register(0X02,0X66);

HAL_Delay(1);

rw_595_Register(0X04,0X07);

HAL_Delay(1);

}

uint8_t rw_595_Register(uint8_t reg,uint8_t data)

{

uint8_t txdata[2] = {reg, data};

if(HAL_SPI_Transmit(&hspi4, txdata ,2,300) != HAL_OK)

{

Error_Handler();

}

return 0;

}

among , Parameters “reg” Indicates the number of nixie tube displays , Parameters “data” Indicates the contents displayed by the nixie tube .

Loop through the main function “rw_595_Register” Function to display specific content on the nixie tube , The experimental results are shown in the figure .

Hardware platform : Huaqing vision FS-MP1A Development board (STM32MP157)

Download some development tutorials : Add QQ Group 459754978, There are in the group file .

Watch some video courses : Personal space of Huaqing vision R & D Center _ Bili, Bili _Bilibili

Taobao purchase link : Huaqing vision stm32mp157 linux Development board stm32 Single chip microcomputer arm Develop embedded learning board

Mobile Taobao sharing code : Copy the text of this line and open hand Amoy ₤T4FPXn3YYJ2₤

原网站

版权声明
本文为[Huaqing vision it open laboratory]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206210908576849.html