| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		
			benoitstjean
 
 
  Joined: 30 Oct 2007 Posts: 590 Location: Ottawa, Ontario, Canada 
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				| PIC24EP - Change baud rate speed at runtime | 
			 
			
				 Posted: Wed Feb 05, 2025 9:20 am     | 
				     | 
			 
			
				
  | 
			 
			
				Device: PIC24EP512GP806
 
Compiler: 5.026
 
 
Hi guys,
 
 
Its been a little while.
 
 
Is it possible to change the UART speed at runtime?
 
 
Reason you ask? Because my PIC is tied to a modem which runs at 115200 by default. Initially when the PIC boots, to make sure that it talks to the modem and configures it properly, I want them both to run at 115200 and when all has been successfully initialized, I want both the PIC and modem to switch to 230400. For the PIC, it's just a matter of sending AT+IPR=230400 but once that is sent, how to I switch the PIC's UART to 230400?
 
 
Thanks!
 
 
Ben | 
			 
		  | 
	
	
		  | 
	
	
		
			Ttelmah
 
 
  Joined: 11 Mar 2010 Posts: 19967
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Wed Feb 05, 2025 10:53 am     | 
				     | 
			 
			
				
  | 
			 
			
				Yes.
 
 
set_uart_speed
 
 
Obviously with stream name, and required baud rate. 
 
Only for a proper hardware UART though. | 
			 
		  | 
	
	
		  | 
	
	
		
			benoitstjean
 
 
  Joined: 30 Oct 2007 Posts: 590 Location: Ottawa, Ontario, Canada 
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Wed Feb 05, 2025 1:16 pm     | 
				     | 
			 
			
				
  | 
			 
			
				Oh geez, was looking in the help and didn't see that!
 
 
Great, thanks!
 
 
Ben | 
			 
		  | 
	
	
		  | 
	
	
		
			Ttelmah
 
 
  Joined: 11 Mar 2010 Posts: 19967
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Thu Feb 06, 2025 3:54 am     | 
				     | 
			 
			
				
  | 
			 
			
				For some reason that is missing in the 'linked' stuff at the end of the #USE 
 
RS232 page in the manual, but is mentioned in the setup_uart entry.
 
One of the manual 'oddities'....    | 
			 
		  | 
	
	
		  | 
	
	
		 |