3329 views|6 replies

1412

Posts

3

Resources
The OP
 

[Topmicro Intelligent Display Module Review] 5. Development Board NUCLEO-F746ZG Communication with Intelligent Display Module [Copy link]

In order to use the development board NUCLEO-F746ZG to establish a connection with the smart display module, I thought it was a very simple thing, but I took a lot of detours and spent some trouble.

First let me tell you about the embarrassing things I encountered:

(1) UART8 of the NUCLEO-F746ZG development board cannot be used. After completing the configuration using STM32CubeMX and writing the program, the development board periodically sends data. Using the USB to TTL tool to monitor the sent data, I found that no data was sent. I briefly looked at the clock configuration: the clock of UART8 is together with LPTIM. Is this the reason? I need to look carefully at the data sheet to find out.

There is no problem using UART7, but it is very strange that UART8 still has no data sent after repeated verification.

(2) TTL to RS232 module. I bought this module online, but it left me with a big problem: the definitions of pins 2 and 3 in its DB9 definition are reversed. Pin 2 should be RXD and pin 3 should be TXD, but I didn't expect that pin 2 is TXD and pin 3 is RXD.

It took me a long time to test it. I changed the modules, and did some wire routing.

After the first two problems are solved, it will be much simpler. Send data regularly in the program:

void SendHIM(uint16_t cmd, uint8_t *Tdata,uint16_t CharLen)
{
    uint16_t   i=0;
  
    SendBuf_COM[0]=FrameHeader;         //0xAA
    SendBuf_COM[1]=cmd;                 //命令
    SendBuf_COM[2+CharLen] = FrameEnd>>24;
    SendBuf_COM[3+CharLen] = (FrameEnd>>16)&0xff;
    SendBuf_COM[4+CharLen] = (FrameEnd&0xffff)>>8;
    SendBuf_COM[5+CharLen] = FrameEnd&0xff;
 
    if(CharLen>0){  
      for(i=0; i<CharLen; i++) //数据
      {
          SendBuf_COM[2+i]=*(Tdata++);
      }      
    }

    sendCount=6+CharLen; //发送数据长度

    HAL_UART_Transmit(&huart7,(uint8_t*)SendBuf_COM,sendCount,1000);	//发送接收到的数据
		while(__HAL_UART_GET_FLAG(&huart7,UART_FLAG_TC)!=SET);		//等待发送结束

}

In addition, I defined the screen commands, you can copy and paste them anytime you want:

//Parameter setting
#define       CMD_ShakeHands                     0x30          //用于确认屏是否连接正常
#define       CMD_ReadVersion                    0x31          //读版本号
#define       CMD_ReadPageNumber                 0x32          //读取当前正在显示的页面 ID
#define       CMD_TouchCoordinatesBack           0x72   //0X73 //自动返回触摸位置坐标
#define       CMD_TouchDataBack                  0x77          //自动返回数据(键盘录入数据或触摸键运算操作数据) 
#define       CMD_TouchIDback                    0x78          //自动返回页面 ID 和触摸键 ID
#define       CMD_SetWorkMode                    0xE0          //设定模块的通信波特率、触摸返回码、文本显示模式
#define       CMD_CutoverProject                 0xE1          //切换到指定工程并显示
#define       CMD_SetTouchScreenCalibration      0xE4          //设定触摸屏进入校准模式
#define       CMD_SetScreensaver                 0x5E          //设置进入屏保时间和屏保状态下的背光亮度
#define       CMD_SetBacklight                   0x5F          //设置背光亮度
#define       CMD_SetBuzzerDuration              0x79          //设置蜂鸣器 1 次的鸣叫时间
#define       CMD_BuzzerControl                  0x7A          //控制蜂鸣器打开关闭、声音频率、时间长短
#define       CMD_SetClock                       0x9C          //设置模块日期时间
#define       CMD_ReadClock                      0x9B          //读取模块日期时间
#define       CMD_WriteFlash                     0x90          //写入数据到 flash (Flash 中数据断电可保存)
#define       CMD_ReadFlash                      0x91          //读取 flash 数据
#define       CMD_ReadUSRBINData                 0x93          //读取 USR.BIN 中用户文件数据
#define       CMD_FormatInternalStorage          0xE2          //格式化内部存储器(工程包,Flash 数据,加密设定都会被清空)
#define       CMD_DecryptInternalMemory          0xE3          //用于内部存储器盘加密的情况下, 对内部存储器进行一次解锁

//Display control
#define       CMD_PageDisplay                    0x70          //显示指定的页面(画面)
#define       CMD_SetControlFontColor            0x7E          //更改页面中字符串变量或数字变量的字体颜色
#define       CMD_SetControlBackgroundColor      0x7F          //改变页面中字符串变量或数字变量的背景色
#define       CMD_SetFont                        0xE7          //设置字库国家码和外扩 Codepage
#define       CMD_RefreshControl                 0xE8          //设定当前画面暂停刷新或开始刷新,暂停刷新后触摸键无响应、变量显示不更新数据。

//Variable read and write
#define       CMD_WriteNumericVariables          0x82          //写数字变量 可往 16/32/64 位数字变量地址中连续写入多个数据
#define       CMD_ReadNumericVariables           0x83          //读数字变量 读取 16/32/64 位数字变量地址中的连续多个数据
#define       CMD_WriteCurveData                 0x4D          //曲线数据写 对曲线图数据写入, 控制曲线图的显示,以修改的方式进行刷新
#define       CMD_PushLefttoWriteCurveData       0x4E          //左推进写曲线数据 对曲线图数据写入, 以推进的方式控制曲线图的显示有利于对数据变化随时间变化的曲线显示减小传输的数据量
#define       CMD_Set8bitSystemRegister          0x3B          //8 位系统寄存器设定 用于控制计数寄存器的工作方式
#define       CMD_ReadSystemRegisterData         0x3C          //读取系统寄存器数据 读取寄存器中数据
#define       CMD_WriteBitmapData                0x4B          //位图数据写 单色位图数据写入, 控制位图显示
#define       CMD_WriteBitmapCompressedData      0x4C          //位图压缩数据写 单色位图压缩数据写入, 可减小数据量,控制位图显示
#define       CMD_WriteStringVariable            0x42          //写字符串变量
#define       CMD_ReadStringVariable             0x43          //读字符串变量 对字符串变量进行读写, 可用于控制字符串控件显示
#define       CMD_FillStringVariables            0x46          //填充字符串变量
#define       CMD_Write16bitNumericVariable      0x3D          //写 16 位数字变量  对 16 位数据变量进行读写, 可用于控制:数值控件显示, 图标索引显示,十进位图标显示进度条显示, VPK 操作等 0x3E 读 16 位数字变量
#define       CMD_Read16bitNumericVariable       0x3E          //填充 16 位数字变量
#define       CMD_Fill16bitNumericVariable       0x3F          //填充 16 位数字变量
#define       CMD_Write32bitNumericVariable      0x44          //写 32 位数字变量对 32 位数据变量进行读写。可用于控制数值控件显示控制十进制图标显示 
#define       CMD_Read32bitNumericVariable       0x45          //读 32 位数字变量
#define       CMD_Fill32bitNumericVariable       0x47          //填充 32 位数字变量
#define       CMD_Write64bitNumericVariable      0x48          //写 64 位数字变量
#define       CMD_Read64bitNumericVariable       0x49          //读 64 位数字变量 对 64 位数据变量进行读写。可用于控制数值控件显示
#define       CMD_Fill64bitNumericVariable       0x4A          //填充 64 位数字变量
#define       CMD_VariableFlashDataExchange      0x94          //变量与 Flash 数据交换 对变量与 Flash 之间进行数据交换
#define       CMD_WriteusrbinFiletoVP            0x95          //写 usr.bin 文件到 VP 从 usr.bin 文件中读取数据到 VP 变量中


#define       FrameHeader                        0xAA          //帧头
#define       FrameEnd                           0xCC33C33C    //帧尾

Everything is ready. After compiling, download the program and see the effect:

This time I just simply established a connection between the development board and the display screen, so I won’t upload the program. After I finish organizing the program and add the functions, I will share it with you.

This post is from Test/Measurement

Latest reply

very good  Details Published on 2021-11-10 18:11
Personal signature

没有什么不可以,我就是我,不一样的烟火! 

 
 

6593

Posts

0

Resources
2
 

The quality of TTL to RS232 modules purchased online varies.

This post is from Test/Measurement

Comments

That's right, I got stuck accidentally.  Details Published on 2021-11-4 09:02
 
 
 

1412

Posts

3

Resources
3
 
The quality of TTL to RS232 modules purchased online varies.

That's right, I got trapped by accident.

This post is from Test/Measurement
 
 
 

6788

Posts

2

Resources
4
 

From the diagram, UART8 does require the support of LPTIM.

This post is from Test/Measurement

Comments

It's possible. I'll take a closer look in two days to find out what the reason is.  Details Published on 2021-11-4 13:26
 
 
 

1412

Posts

3

Resources
5
 
wangerxian posted on 2021-11-4 10:33 From the diagram, UART8 does require LPTIM support.

It's possible. I'll take a closer look in two days to find out what the reason is.

This post is from Test/Measurement
Personal signature

没有什么不可以,我就是我,不一样的烟火! 

 
 
 

7462

Posts

2

Resources
6
 

Support it, it looks much better with comments.

This post is from Test/Measurement
Personal signature

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

 
 
 

1

Posts

1

Resources
7
 
very good
This post is from Test/Measurement
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
Analysis of China Mobile and China Unicom packages: choosing the wrong package will lead to wasted money

Source: Beijing Entertainment News     Although many people have mobile phones, the cost of mobile phone is still ve ...

Recommended wireless router products from four major brands

Source: Zhongguancun Online The most well-known brands in the wireless market are definitely TP-Link, D-Link , Netgear ...

PIC mid-range microcontroller series-10-bit AD converter

Previously, we talked about the AD converter of 8-bit microcontroller. This article will introduce the converter of 10-b ...

Sound detection system

# Sound Detection System##Sound Detection System###The sound detection system is used to capture sound and display the t ...

Review summary: Flathead RVB2601

Event details: Review | Free trial_Electronic Engineering World (eeworld.com.cn) Updated as of September 23 Evaluatio ...

【Development and application based on NUCLEO-F746ZG motor】13. Parameter configuration - USART3 configuration

The function of this serial port on the development board is to communicate with ST-LINK, and then connect ST_LINK2 to t ...

IoT architecture and technology protocols

This chapter introduces the technical architecture used to support Internet of Things (IoT) applications and discusses s ...

CN3085 as NiMH battery charger

Domestic chip, the circuit is very simple, used for charging NiMH batteries, made into 4 independent charging channels. ...

Analysis of AC Motors and Their Systems (Second Edition)

This book mainly studies related systems centered on AC motors, focusing on analysis methods and operating performance. ...

【Sipeed Tang Primer 25K】Review: 3. How about a worm lamp?

This post was last edited by xiyou2020eeeee on 2024-1-15 20:53 Brief introduction Tang Primer 25K has rich interface ...

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