Simple UART on Mesa 6i25 with 5i25 firmware

More
06 Nov 2015 23:14 #64909 by andypugh

It might be simplest just to comment out the "return -EINVAL" so that you get the warning but execution continues.

would not help.

Indeed, it is better to remove the call to hm2_module_is_consistent_or_complain from the uart.c driver.
The following user(s) said Thank You: sirop

Please Log in or Create an account to join the conversation.

More
06 Nov 2015 23:17 #64910 by PCW
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
The following user(s) said Thank You: sirop

Please Log in or Create an account to join the conversation.

More
06 Nov 2015 23:21 #64911 by sirop

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.

More
07 Nov 2015 01:02 #64922 by PCW
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
The following user(s) said Thank You: sirop

Please Log in or Create an account to join the conversation.

More
07 Nov 2015 04:07 #64929 by sirop

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.

More
10 Nov 2015 04:25 #65058 by sirop
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:
buff = (rtapi_u32)((bitrate * 1048576.0)/inst->clock_freq); //20 bits in this version
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.

Please Log in or Create an account to join the conversation.

More
10 Nov 2015 09:48 #65063 by andypugh

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.

More
10 Nov 2015 16:53 #65081 by PCW
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)
The following user(s) said Thank You: sirop

Please Log in or Create an account to join the conversation.

More
12 Mar 2016 21:53 #71509 by pmcstoneinc
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.

Please Log in or Create an account to join the conversation.

More
12 Mar 2016 22:09 #71511 by sirop

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: PCWjmelson
Time to create page: 0.189 seconds
Powered by Kunena Forum