I2C vs 5i22
04 May 2015 19:14 #58370
by fupeama
I2C vs 5i22 was created by fupeama
Hi,
I try to write hal modul for communication with I2c device.
I connect SDA and SCL pins directly on 5i22, but there is big time delay between gpio IN and OUT pins.
I try wired gpio OUT to another gpio IN and generate signal by pwmgen and read this pins in halscope. Delay is same cca 0.01sec.
Is it normal?
thanks Martin
I try to write hal modul for communication with I2c device.
I connect SDA and SCL pins directly on 5i22, but there is big time delay between gpio IN and OUT pins.
I try wired gpio OUT to another gpio IN and generate signal by pwmgen and read this pins in halscope. Delay is same cca 0.01sec.
Is it normal?
thanks Martin
Please Log in or Create an account to join the conversation.
04 May 2015 21:22 #58372
by PCW
Replied by PCW on topic I2C vs 5i22
Note that you will not be able to view PWM outputs or other high speed outputs accurately
with halscope because halscope only samples the inputs at the servo (or base) thread rate.
This will cause aliasing so what halscope shows is not an accurate representation of the signal on the pin
en.wikipedia.org/wiki/Aliasing
with halscope because halscope only samples the inputs at the servo (or base) thread rate.
This will cause aliasing so what halscope shows is not an accurate representation of the signal on the pin
en.wikipedia.org/wiki/Aliasing
Please Log in or Create an account to join the conversation.
05 May 2015 03:03 #58385
by fupeama
Replied by fupeama on topic I2C vs 5i22
Yes,
I know that the signal must have a small delay, but this delay is 0.01 sec.
Halscope sampling frequency is 20kHz and Hal modul for generating SDA and SCL signals pass through 4x-5x in this delta time
PWMgen frequency is setup only on 100Hz. Its linuxcnc pwmgen, not mesa pwmgen.
M
I know that the signal must have a small delay, but this delay is 0.01 sec.
Halscope sampling frequency is 20kHz and Hal modul for generating SDA and SCL signals pass through 4x-5x in this delta time
PWMgen frequency is setup only on 100Hz. Its linuxcnc pwmgen, not mesa pwmgen.
M
Please Log in or Create an account to join the conversation.
05 May 2015 07:17 #58390
by PCW
Replied by PCW on topic I2C vs 5i22
There is no significant delay in the GPIO driver or hardware so the delay
must be in your component logic somehow.
That is, if you set a GPIO pin, you can read it in the next cycle
(not the current cycle because with standard thread order writes are done after reads)
You can easily verify this by doing (something like) the following:
setp hm2_5i22.0.gpio.095.is_output true
net toggle95 hm2_5i22.0.gpio.095.in_not => hm2_5i22.0.gpio.095.out
This will toggle with a frequency of 1/2 the servo thread rate
(assuming the hm2 read and write functions are invoked at the servo thread rate)
Here's an example:
freeby.mesanet.com/toggle.png
must be in your component logic somehow.
That is, if you set a GPIO pin, you can read it in the next cycle
(not the current cycle because with standard thread order writes are done after reads)
You can easily verify this by doing (something like) the following:
setp hm2_5i22.0.gpio.095.is_output true
net toggle95 hm2_5i22.0.gpio.095.in_not => hm2_5i22.0.gpio.095.out
This will toggle with a frequency of 1/2 the servo thread rate
(assuming the hm2 read and write functions are invoked at the servo thread rate)
Here's an example:
freeby.mesanet.com/toggle.png
Please Log in or Create an account to join the conversation.
06 May 2015 17:38 #58427
by fupeama
Replied by fupeama on topic I2C vs 5i22
I changed HM2_5i22.0read and write to base thread with fp and now its ok.
Thanks. M
Thanks. M
Please Log in or Create an account to join the conversation.
06 May 2015 20:05 #58436
by andypugh
There is an option to read/write _only_ GPIO in a non-fp base thread. That might be a better solution. (the read_gpio and write_gpio functions)
www.linuxcnc.org/docs/html/man/man9/hostmot2.9.html#FUNCTIONS
Replied by andypugh on topic I2C vs 5i22
I changed HM2_5i22.0read and write to base thread with fp and now its ok.
Thanks. M
There is an option to read/write _only_ GPIO in a non-fp base thread. That might be a better solution. (the read_gpio and write_gpio functions)
www.linuxcnc.org/docs/html/man/man9/hostmot2.9.html#FUNCTIONS
Please Log in or Create an account to join the conversation.
Time to create page: 0.384 seconds