Simple UART on Mesa 6i25 with 5i25 firmware
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						06 Nov 2015 23:14				#64909
		by andypugh
	
	
		
			
				
					
	
	
			 		
													
	
				Replied by andypugh on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			Indeed, it is better to remove the call to hm2_module_is_consistent_or_complain from the uart.c driver.
would not help.It might be simplest just to comment out the "return -EINVAL" so that you get the warning but execution continues.
		The following user(s) said Thank You: sirop 	
			Please Log in or Create an account to join the conversation.
- PCW
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 17380
 - Thank you received: 5067
 
			
	
						06 Nov 2015 23:17				#64910
		by PCW
	
	
		
			
	
	
			 		
													
	
				Replied by PCW on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			
				Actually there's no problem at all unless you need to _combine_ Sserial or BSPI with the UART
It just means you need to set the proper instance stride in the vhdl file
					It just means you need to set the proper instance stride in the vhdl file
		The following user(s) said Thank You: sirop 	
			Please Log in or Create an account to join the conversation.
- sirop
 - 
				
									Topic Author
											 - Offline
 - Elite Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 193
 - Thank you received: 57
 
			
	
						06 Nov 2015 23:21				#64911
		by sirop
	
	
		
			
				
Is x"10" the proper instance stride if only UARTTTag and UARTRTag are needed?
					
	
			
			 		
													
	
				Replied by sirop on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			Actually there's no problem at all unless you need to _combine_ Sserial or BSPI with the UART
It just means you need to set the proper instance stride in the vhdl file
Is x"10" the proper instance stride if only UARTTTag and UARTRTag are needed?
Please Log in or Create an account to join the conversation.
- PCW
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 17380
 - Thank you received: 5067
 
			
	
						07 Nov 2015 01:02				#64922
		by PCW
	
	
		
			
	
	
			 		
													
	
				Replied by PCW on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			
				Isn't that what the comment says:
InstStride1: integer := 64; -- instance stride 1 = 64 bytes = 16 x 32 bit registers !! UARTS need 0x10
-- InstStride1: integer := 16; -- instance stride 1 = 64 bytes = 16 x 32 bit registers !! UARTS need 0x10
					InstStride1: integer := 64; -- instance stride 1 = 64 bytes = 16 x 32 bit registers !! UARTS need 0x10
-- InstStride1: integer := 16; -- instance stride 1 = 64 bytes = 16 x 32 bit registers !! UARTS need 0x10
		The following user(s) said Thank You: sirop 	
			Please Log in or Create an account to join the conversation.
- sirop
 - 
				
									Topic Author
											 - Offline
 - Elite Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 193
 - Thank you received: 57
 
			
	
						07 Nov 2015 04:07				#64929
		by sirop
	
	
		
			
				
I finally understood what you meant.
As all the other pins in my case have InstStride0: integer := 4, I just comment out InstStride1: integer := 64
and use InstStride1: integer := 16 instead.
Then I do not need to edit hostmot2.c.
Just rebuilt the firmware and it worked.
Thanks.
					
	
			
			 		
													
	
				Replied by sirop on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			Actually there's no problem at all unless you need to _combine_ Sserial or BSPI with the UART
It just means you need to set the proper instance stride in the vhdl file
I finally understood what you meant.
As all the other pins in my case have InstStride0: integer := 4, I just comment out InstStride1: integer := 64
and use InstStride1: integer := 16 instead.
Then I do not need to edit hostmot2.c.
Just rebuilt the firmware and it worked.
Thanks.
Please Log in or Create an account to join the conversation.
- sirop
 - 
				
									Topic Author
											 - Offline
 - Elite Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 193
 - Thank you received: 57
 
			
	
						10 Nov 2015 04:25				#65058
		by sirop
	
	
		
			
	
			
			 		
													
	
				Replied by sirop on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			
				Hallo again.
I am looking at int hm2_uart_setup(char *name, int bitrate, rtapi_s32 tx_mode, rtapi_s32 rx_mode) .
What does this line and its comment mean:git.linuxcnc.org/gitweb?p=linuxcnc.git;a...d0908c8f5b7e9d1#l155
Ok, 1048576=2^20, so we get a buffer size for a given bitrate and clock frequency.
But is the meaning of the comment?
Is it the driver version which is meant?
Or is it also the Mesa card model which is meant?
Thanks.
					I am looking at int hm2_uart_setup(char *name, int bitrate, rtapi_s32 tx_mode, rtapi_s32 rx_mode) .
What does this line and its comment mean:
buff = (rtapi_u32)((bitrate * 1048576.0)/inst->clock_freq); //20 bits in this versionOk, 1048576=2^20, so we get a buffer size for a given bitrate and clock frequency.
But is the meaning of the comment?
Is it the driver version which is meant?
Or is it also the Mesa card model which is meant?
Thanks.
Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						10 Nov 2015 09:48				#65063
		by andypugh
	
	
		
			
				
I imagine so, It is probably based on something in the regmap file.
					
	
	
			 		
													
	
				Replied by andypugh on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			But is the meaning of the comment?
Is it the driver version which is meant?
I imagine so, It is probably based on something in the regmap file.
		The following user(s) said Thank You: sirop 	
			Please Log in or Create an account to join the conversation.
- PCW
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 17380
 - Thank you received: 5067
 
			
	
						10 Nov 2015 16:53				#65081
		by PCW
	
	
		
			
	
	
			 		
													
	
				Replied by PCW on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			
				The UART uses a phase accumulator for baud rate generation, this phase accumulator is 20 bits long
That means that the baud rate register value needs to be set to baudrate*2^20/Clock
(Phase accumulators are used for baud rate setting rather than the more normal programmable
dividers because I wanted high resolution baud rate sett-ability at high baud rates and programmable dividers
dont do this well)
					That means that the baud rate register value needs to be set to baudrate*2^20/Clock
(Phase accumulators are used for baud rate setting rather than the more normal programmable
dividers because I wanted high resolution baud rate sett-ability at high baud rates and programmable dividers
dont do this well)
		The following user(s) said Thank You: sirop 	
			Please Log in or Create an account to join the conversation.
- pmcstoneinc
 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 58
 - Thank you received: 1
 
			
	
						12 Mar 2016 21:53				#71509
		by pmcstoneinc
	
	
		
			
	
			
			 		
													
	
				Replied by pmcstoneinc on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			
				With that being said whats the bit rate value for 3Mbps on a 7i92 (50Mhz clock low?)
(3000000 * 2^20) / 5000000 = 62914.56 ??
Let me know. Thanks.
					(3000000 * 2^20) / 5000000 = 62914.56 ??
Let me know. Thanks.
Please Log in or Create an account to join the conversation.
- sirop
 - 
				
									Topic Author
											 - Offline
 - Elite Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 193
 - Thank you received: 57
 
			
	
						12 Mar 2016 22:09				#71511
		by sirop
	
	
		
			
				
You set the baud rate [= bit rate] as you need it. UART should do up to 10 Mbit/s.
Do not forget about the start and stop bits.
Maybe, you would do better with Packet UART on that frequency?
I prepared PktUART for machinekit: see the latest commits beginning from github.com/sirop/machinekit/commit/3446d...ee7211f94f1a1a2462d5
To use them with LinuxCNC you'll only need to subsitute u8, u16 and so on with rtapi_u8, rtapiu_16 ....
as I see it.
					
	
			
			 		
													
	
				Replied by sirop on topic Simple UART on Mesa 6i25 with 5i25 firmware			
			With that being said whats the bit rate value for 3Mbps on a 7i92 (50Mhz clock low?)
(3000000 * 2^20) / 5000000 = 62914.56 ??
Let me know. Thanks.
You set the baud rate [= bit rate] as you need it. UART should do up to 10 Mbit/s.
Do not forget about the start and stop bits.
Maybe, you would do better with Packet UART on that frequency?
I prepared PktUART for machinekit: see the latest commits beginning from github.com/sirop/machinekit/commit/3446d...ee7211f94f1a1a2462d5
To use them with LinuxCNC you'll only need to subsitute u8, u16 and so on with rtapi_u8, rtapiu_16 ....
as I see it.
Please Log in or Create an account to join the conversation.
		Moderators: PCW, jmelson	
		Time to create page: 0.117 seconds