[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
Próxima revisiónAmbos lados, revisión siguiente
es:howtos:hardware:arm:interfacing_i2c_devices [2019/07/21 19:37 (UTC)] – [Comunicación con un dispositivo I2C] rrampes:howtos:hardware:arm:interfacing_i2c_devices [2019/07/21 23:41 (UTC)] – [Desplazamiento del nivel de tensión] rramp
Línea 109: Línea 109:
 Considerando que mi temperatura ambiente actual es cerca de 20 grados Celcius supongo que para los datos no calibrados está bien. Considerando que mi temperatura ambiente actual es cerca de 20 grados Celcius supongo que para los datos no calibrados está bien.
  
-Si quieres un script que haga las matemáticas para ti y solo leer la salida del sensor ITG32000 en un formato legible por un humano aquí tienes un ejemplo:+Si quieres un script que haga las matemáticas para ti y sólo leer la salida del sensor ITG32000 en un formato legible por un humano aquí tienes un ejemplo:
  
   #!/bin/bash   #!/bin/bash
Línea 152: Línea 152:
   echo "ibase=16; input=$RZH$RZL; if ( input >= 8000 ) { raw= input - 10000;} else { raw=input;}; raw / E.177" |bc -l   echo "ibase=16; input=$RZH$RZL; if ( input >= 8000 ) { raw= input - 10000;} else { raw=input;}; raw / E.177" |bc -l
  
-The above script just does one simple dump of the register data and converts the values into human readable formatit does nothing with regards to calibration and averaging out vibrationsMore consistent gyroscopic readings would be achieved if an average over 10 consecutive data samples was made thus averaging out most of the ambient vibrations+El script anterior sólo hace un simple volcado de los datos de registro y convierte los valores en un formato legible para el ser humanono hace nada con respecto a la calibración y el promedio de las vibracionesSe lograrían lecturas giroscópicas más consistentes si se hiciera un promedio de 10 muestras de datos consecutivos, lo que permitiría obtener un promedio de la mayoría de las vibraciones ambientales
  
-A bash script is really not the most suitable way to read data from I2C devicesa faster means of managing the data from the devices is really mandatory in order to do calibrationdata averaging and what more to make the information consistent and useful for further calculationsI found the Linux kernel i2c documentation a usefull reference (<kernel source tree>/Documentation/i2c/dev-interface); it's not the only way that data can be read but it's a good starting point.+Un script en bash no es realmente la forma más adecuada de leer datos de dispositivos I2C, una forma más rápida de gestionar los datos de los dispositivos es realmente obligatorio para realizar calibracionespromedios de datos y, lo que es más, para que la información sea coherente y útil para cálculos posteriores. 
 +La documentación del núcleo de Linux para i2c me pareció una referencia útil (<kernel source tree>/Documentation/i2c/dev-interface); no es la única manera de que los datos puedan ser leídos, pero es un buen punto de partida.
  
-I hate showing my poor programming capabilities but here's some code that uses i2c-dev to read stuff from the ITG3200 and takes an average over 10 readings:+Odio mostrar mis pobres capacidades de programación en C, pero aquí hay un código que usa i2c-dev para leer cosas de la ITG3200 y toma un promedio de más de 10 lecturas:
  
   #include <sys/ioctl.h>   #include <sys/ioctl.h>
Línea 274: Línea 275:
  
  
-====== Voltage Level Shifting ======+====== Desplazamiento del nivel de tensión ====== 
 + 
 +Usted puede terminar con dispositivos de nivel de voltaje heterogéneo y si tiene muchos dispositivos, la manera correcta de solucionar este problema es usando desplazadores de nivel de voltaje I2C bidireccionales como el, [[ http://www.ti.com/lit/ds/symlink/pca9306.pdf |PCA9306]], pero si sólo tiene unos pocos dispositivos agrupados en una placa de circuito impreso como la unidad IMU 10DOF, es posible que desee probar un sistema más sencillo. 
 +Así es como conecté mi pcb IMU de 5V a un bus I2C de 3.3V en mi Raspberry PI:  
 You may end up with heterogeneous voltage level devices and if you have many devices the correct way to work around this problem is by using bidirectional I2C voltage level shifters like the [[ http://www.ti.com/lit/ds/symlink/pca9306.pdf |PCA9306]], but if you only have a few devices all grouped up in a neat PCB like the 10DOF IMU unit you might want to give a simpler system a try. You may end up with heterogeneous voltage level devices and if you have many devices the correct way to work around this problem is by using bidirectional I2C voltage level shifters like the [[ http://www.ti.com/lit/ds/symlink/pca9306.pdf |PCA9306]], but if you only have a few devices all grouped up in a neat PCB like the 10DOF IMU unit you might want to give a simpler system a try.
 This is how I connected my 5v IMU pcb to a 3.3v I2C bus on my RaspberryPI: I took as educated guess that 4.4v (5v with a 4148 diode in series) would still be a tolerable power supply voltage for the whole IMU pcb, this would most likely allow all the I2C devices on the IMU pcb to recognize a minimum of 3.08v (4.4 * 0.7) as the lowest reliable logic level 1 tension allowing it to inter-operate with the PI's 3.3v logig levels. I was not able to find if the PI has internal pullups on the I2C bus or if they have to be externally placed so in doubt I put in 10k pullups between the 4.4v power line and the 2 data lines. I was the able to correctly detect the sensors on the IMU pcb.    This is how I connected my 5v IMU pcb to a 3.3v I2C bus on my RaspberryPI: I took as educated guess that 4.4v (5v with a 4148 diode in series) would still be a tolerable power supply voltage for the whole IMU pcb, this would most likely allow all the I2C devices on the IMU pcb to recognize a minimum of 3.08v (4.4 * 0.7) as the lowest reliable logic level 1 tension allowing it to inter-operate with the PI's 3.3v logig levels. I was not able to find if the PI has internal pullups on the I2C bus or if they have to be externally placed so in doubt I put in 10k pullups between the 4.4v power line and the 2 data lines. I was the able to correctly detect the sensors on the IMU pcb.   
 es:howtos:hardware:arm:interfacing_i2c_devices ()