5865 views|8 replies

2870

Posts

4

Resources
The OP
 

What are the conditions for enabling the serial port interrupt USART_INT_IDLE of GD32F103? [Copy link]

 

When I initialized UART, I added the idle setting.

usart_enable(USART0);
  
/* enable USART0 receive interrupt */
usart_interrupt_enable(USART0, USART_INT_RBNE);
usart_interrupt_enable(USART0, USART_INT_IDLE);

However, after receiving data, the interrupt can enter, but USART_INT_IDLE never occurs

void USART0_IRQHandler(void)
{
   uint8_t uart_data; 
   if(RESET != usart_interrupt_flag_get(USART0, USART_INT_FLAG_RBNE)){

	 usart_interrupt_flag_clear(USART0, USART_INT_FLAG_RBNE);         
	 /* read one byte from the receive data register */
	    uart_data  = (uint8_t)usart_data_receive(USART0);
     rx_buffer[rx_counter++] = uart_data;
    
    }       

	if(RESET != usart_interrupt_flag_get(USART0, USART_INT_IDLE))
    {
		usart_interrupt_flag_clear(USART0, USART_INT_IDLE);         
	    rx_idel = TRUE;
	}
		
    if(RESET != usart_interrupt_flag_get(USART0, USART_INT_FLAG_TBE)){
         usart_interrupt_flag_clear(USART0, USART_INT_FLAG_TBE);
    }
		
}

Could you please tell me what are the conditions for enabling the GD32F103 interrupt USART_INT_IDLE?

This post is from Domestic Chip Exchange

Latest reply

I have already posted a post, you can just refer to it: 【GD32F310G-START】USART indefinite length reception - GD32 MCU - Electronic Engineering World - Forum (eeworld.com.cn)   Details Published on 2022-6-4 16:18
 
 

6841

Posts

11

Resources
2
 
Do you want to do indefinite length reception? Do you mean the conditions for entering interrupt?
This post is from Domestic Chip Exchange

Comments

Yes, I use this interrupt in stm32, but once GD32 is turned on, not only can it not be interrupted, but it also behaves abnormally in various ways.  Details Published on 2022-6-3 17:18
 
 
 

2870

Posts

4

Resources
3
 
lugl4313820 posted on 2022-6-3 12:25 Do you want to do indefinite length reception? Are you talking about the conditions for entering the interrupt?

Yes, I use this interrupt in stm32, but once GD32 is turned on, not only can it not be interrupted, but it also behaves abnormally in various ways.

This post is from Domestic Chip Exchange

Comments

Idle interrupt, different products and chips have different definitions of idle interrupt, so the specific implementation should be based on practice. In fact, the best implementation method is the timer detection method, which is universal. The idle interrupt of STM32 is more applicable. The CH582 I used last time is quite different from STM32!  Details Published on 2022-6-3 21:38
 
 
 

6841

Posts

11

Resources
4
 
bigbat posted on 2022-6-3 17:18 Yes, I used this interrupt in stm32, but once GD32 is turned on, not only can it not be interrupted, but it is also abnormal in various ways.

Idle interrupt, different products and chips have different definitions of idle interrupt, so the specific implementation should be based on practice. In fact, the best implementation method is the timer detection method, which is universal. The idle interrupt of STM32 is more applicable. The CH582 I used last time is quite different from STM32!

This post is from Domestic Chip Exchange

Comments

This is what I have read in the GD32 manual: "This interrupt is generated after receiving data, that is, after USART_INT_FLAG_RBNE is set, if the bus has a cycle of 'idle', this interrupt will be generated. This seems to be the same as the understanding of stm32, which says: You need to interrupt USART_INT_RBNE  Details Published on 2022-6-4 10:13
 
 
 

2870

Posts

4

Resources
5
 
lugl4313820 posted on 2022-6-3 21:38 Idle interrupts, different products and chips have different definitions of idle interrupts. The specific implementation depends on practice. In fact, the best way to implement it is a timer...

This is what I have read in the GD32 manual: "This interrupt is generated after receiving data, that is, after USART_INT_FLAG_RBNE is set, if the bus is 'idle' for a cycle, this interrupt will be generated. This seems to be the same as the understanding of stm32. It says: It needs to be detected before the USART_INT_RBNE interrupt, and the usart_interrupt_flag_get function will clear the flag. I tried this but it didn't work.

This post is from Domestic Chip Exchange

Comments

You can enter the interrupt by setting the length of the idle interrupt to 1   Details Published on 2022-6-4 10:20
 
 
 

6841

Posts

11

Resources
6
 
bigbat posted on 2022-6-4 10:13 This is what I have read in the GD32 manual: "This interrupt is after receiving data, that is, after USART_INT_FLAG_RBNE is set, if there is a bus...

You can enter the interrupt by setting the length of the idle interrupt to 1

This post is from Domestic Chip Exchange

Comments

Give me some tips, how to set it? Tell me the code, in stm32, USART_INT_RBNE is not needed, only USART_INT_IDLE is enough, but I didn't succeed either.  Details Published on 2022-6-4 10:51
 
 
 

2870

Posts

4

Resources
7
 
lugl4313820 posted on 2022-6-4 10:20 You can enter the interrupt by setting the length of the idle interrupt to 1

Give me some tips, how to set it? Tell me the code, in stm32, USART_INT_RBNE is not needed, only USART_INT_IDLE is enough, but I didn't succeed either.

This post is from Domestic Chip Exchange

Comments

Wait, I'll study it and write a post then.  Details Published on 2022-6-4 15:45
 
 
 

6841

Posts

11

Resources
8
 
bigbat posted on 2022-6-4 10:51 Give me some tips, how to set it? Talk about the code, in stm32, USART_INT_RBNE is not needed, only USART_INT_IDLE is enough, but I also...

Wait, I'll study it and write a post then.

This post is from Domestic Chip Exchange

Comments

I have posted a thread, you can refer to it: [GD32F310G-START] USART indefinite length reception - GD32 MCU - Electronic Engineering World - Forum (eeworld.com.cn)  Details Published on 2022-6-4 16:18
 
 
 

6841

Posts

11

Resources
9
 
lugl4313820 posted on 2022-6-4 15:45 Wait, I'll study it and write a post then.

I have already posted a post, you can just refer to it:

【GD32F310G-START】USART indefinite length reception - GD32 MCU - Electronic Engineering World - Forum (eeworld.com.cn)

This post is from Domestic Chip Exchange
 
 
 

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