1509 views|4 replies

1455

Posts

1

Resources
The OP
 

[ ST NUCLEO-U575ZI-Q Review ]+ Control LED lights with commands [Copy link]

This post was last edited by jinglixixi on 2023-1-4 08:45

In order to check the subsequent design, first test the control of the LED light by command.

There are three LED lights, red, green and blue, on the development board. To control their on and off, three instructions are assigned to them and stored in an array. The instructions are as follows:

uint8_t aTxBuffer1[] = {0x74,0x31,0xff,0xff,0xff};

uint8_t aTxBuffer2[] = {0x74,0x32,0xff,0xff,0xff};

uint8_t aTxBuffer3[] = {0x74,0x33,0xff,0xff,0xff};

The received instructions are also stored in an array, which is defined as:

uint8_t aRxBuffer[5];

The main control program is as follows:

int main(void)
{
  HAL_Init();
  SystemClock_Config();
  SystemPower_Config();
  MX_GPIO_Init();
  MX_ICACHE_Init();
  MX_USART2_UART_Init();
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Off(LED1);
  BSP_LED_Off(LED2);
  BSP_LED_Off(LED3);
  while (1)
  {
    HAL_UART_Receive(&huart2, (uint8_t *)aRxBuffer, 5, 5000);
    if (Buffercmp((uint8_t *)aTxBuffer1, (uint8_t *)aRxBuffer, 5)==0)
    {
        BSP_LED_On(LED1);
    	BSP_LED_Off(LED2);
        BSP_LED_Off(LED3);
    }
	
    if (Buffercmp((uint8_t *)aTxBuffer2, (uint8_t *)aRxBuffer, 5)==0)
    {
        BSP_LED_On(LED2);
    	BSP_LED_Off(LED1);
        BSP_LED_Off(LED3);
    }
	
    if (Buffercmp((uint8_t *)aTxBuffer3, (uint8_t *)aRxBuffer, 5)==0)
    {
        BSP_LED_On(LED3);
        BSP_LED_Off(LED1);
        BSP_LED_Off(LED2);
    }
    aRxBuffer[1] = 0x30;
 }
}

After the program is compiled and downloaded, a serial port debugging tool can be provided to send instructions to the development board. Its interface is shown in Figure 1.

Figure 1 Sending instructions

The corresponding control effects are shown in FIG. 2 to FIG. 4 , where the t1 instruction is used to light up the green LED, the t2 instruction is used to light up the blue LED, and the t3 instruction is used to light up the red LED.

Figure 2: Turning on LED 1

Figure 3: Turning on LED 2

Figure 4 Turning on LED 3

image.png (211.07 KB, downloads: 0)

image.png

image.png (214.62 KB, downloads: 0)

image.png
This post is from RF/Wirelessly

Latest reply

Review summary: Free application | ST NUCLEO-U575ZI-Q https://bbs.eeworld.com.cn/thread-1228653-1-1.html   Details Published on 2023-1-12 09:37
 

6841

Posts

11

Resources
2
 

This is awesome, I haven't figured out DMA indefinite length reception yet. Can DMA indefinite length interrupt be implemented?

This post is from RF/Wirelessly

Comments

I haven't tried it either, but it should be possible. You need to add an identifier to assist in the processing.  Details Published on 2023-1-4 10:35
I haven't tried it either, but it should be possible. You need to add an identifier to assist in the processing.  Details Published on 2023-1-4 08:39
 
 

1455

Posts

1

Resources
3
 
lugl4313820 posted on 2023-1-3 13:28 This is awesome. I haven't figured out DMA variable length reception yet. Can DMA variable length interrupt be implemented?

I haven't tried it either, but it should be possible. You need to add an identifier to assist in the processing.

This post is from RF/Wirelessly
 
 
 

6075

Posts

6

Resources
4
 
lugl4313820 posted on 2023-1-3 13:28 This is awesome. I haven't figured out DMA variable length reception yet. Can DMA variable length interrupt be implemented?

Serial port DMA indefinite length data reception is generally implemented through the serial port idle interrupt, or through the flag, but the idle interrupt is more useful

This post is from RF/Wirelessly
Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 
 

1w

Posts

204

Resources
5
 

Review summary: Free application | ST NUCLEO-U575ZI-Q https://bbs.eeworld.com.cn/thread-1228653-1-1.html

This post is from RF/Wirelessly
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
Personal signature

玩板看这里:

https://bbs.eeworld.com.cn/elecplay.html

EEWorld测评频道众多好板等你来玩,还可以来频道许愿树许愿说说你想要玩的板子,我们都在努力为大家实现!

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
C51 programming of real-time clock chip DS1302

C51 programming of real-time clock chip DS1302 is divided into 8 parts

Analog Circuit Basics Tutorial! E-book

Recommended ★★★★★ Data Type E-books Document language Simplified Chinese

Self-study experience of single chip microcomputer

Whether you are an amateur electronics enthusiast or a practitioner in the electronics industry, mastering microcontroll ...

Some experience summary on AD conversion design

I saw a blog post about the basic issues in AD conversion design, so I reposted it here to share with you. Understanding ...

Senior programmer talks: My opinion on the reliability design of embedded C language

Senior programmer talks: My opinion on the reliability design of embedded C language Preface The reliability of equipm ...

ALLEGRO PROBLEMS

491674 How should the Allegro routing be adjusted? It doesn't seem as convenient as AD. Is there any good way to adjust ...

Moderator Work Rewards for July 2021

The list of moderators who received the July 2021 work rewards is as follows: username Post Reply Featured Rat ...

What does RF and FC mean in radio frequency cards?

I would like to ask what RF and FC involved in radio frequency cards mean, as shown in the figure below, and what does / ...

Please tell me why this machine often burns the starting resistor at the customer's place

Please tell me why the resistor burned out and how to fix it? 627875627874627873

【Digi-Jet Follow me Issue 4】Project Summary

75a4b91c996f6d1fd951a4b0b5082c81 Preface I didn't receive any email after registering for the fourth phase. I felt that ...

快速回复 返回顶部 Return list