i2c

How to Use I2C with XC16 Using MCC - Microchip

走远了吗. 提交于 2020-03-05 04:58:49
问题 This is the first time I've attempted to use I2C for my design so bear with me. I've used the MCC to set up I2C and I have I2C.c and I2C.h. I'm trying to read a pressure sensor value. The value is 15 bits long. Do I need to write to the slave before I read or can I just read the value straight away? I've put part of my code below. You can see that I'm only trying to read a pressure value. Can anyone point me in the right direction of how to achieve this? Thanks guys. NOTE: Using a

I/O Error [121] between Arduino and Rpi using i2c communication

不羁的心 提交于 2020-02-07 04:04:04
问题 I have connected Rpi with Arduino using i2c communication. Pin Configuration: Rpi ---- Arduino Mega SDA SDA SCL SCL GND GND I also have an encoder attached to Rpi. Encoder `------ Rpi 5V 5V Gnd Gnd Output A Gpio 17 (BCM layout) Output B Gpio 18 (BCM Layout) Code is working perfectly fine, however after sometime, I am getting an error: 121, Remote I/O Error. Also, before the error (before starting the communication), on executing i2cdetect -y 1, I see only one slave address (20) same address

Operator “|” usage is c raspberry pi

走远了吗. 提交于 2020-01-17 17:57:39
问题 I am using raspberry pi to read a gyroscopic data. Am new to it but so far I understand everything that I am basing my code from besides the use of "|" in it. When looking it up it says its "bitwise OR" operator but in my situation it doesnt make sense, than again I don't understand the explanation on Wikipedia. The line that uses it looks as follows readBlock(0x80 | OUT_X_L_G, sizeof(block), block); readBlock is user defined function as follows. readBlock(uint8_t command, uint8_t size, uint8

AVR I2C trouble

僤鯓⒐⒋嵵緔 提交于 2020-01-16 08:35:31
问题 I am trying to communicate using I2C with AT90CAN128, But it is not going further than following while loop: while(!(TWCR & (1<<TWINT))); It remains in the while loop. According to me, it is not able to set TWINT flag. void TWI_start(void) { TWCR= (1<<TWINT)|(1<<TWSTA)|(1<<TWEN); while(!(TWCR & (1<<TWINT)));`enter code here` while((TWSR & 0xF8)!= 0x08); } Any suggestions? 回答1: Probably a hardware problem. The TWI Master tries to assert SDA and SCL and checks if both SDA and SCL are at GND.

How to properly initialize I2C stm32?

╄→гoц情女王★ 提交于 2020-01-14 15:49:10
问题 I want to get data from ADXL345 accelerometer,but seems that I incorrectly connect it. SCL- PC6(with 10k resistor) SDA- PC7(with 10k resistor) SDO- GND CS - VCC GND - GND 3.3v - VCC Here is my code to initalize: void I2CG_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; I2C_InitTypeDef I2C_InitStructure; RCC_AHBPeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); RCC_AHBPeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); // I2CG clock enable RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2CG, ENABLE); RCC

How do I use the STM32CUBEF4 HAL library to read out the sensor data with i2c?

家住魔仙堡 提交于 2020-01-12 08:26:15
问题 I want to use the latest HAL library instead of Standard Peripheral Library. And i want to readout the BMA250E G-sensor's chip_id, but it doesn't work. Value of aRxBuffer always keep at 0x00. But it should be 0xf9! What's wrong in my code? ‪#‎include‬ "stm32f4xx_hal.h" #define I2Cx_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() #define I2Cx_SDA_PIN GPIO_PIN_9 #define I2Cx_SDA_GPIO_PORT GPIOB #define I2Cx_SDA_AF GPIO_AF4_I2C1 #define I2Cx_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()

How do I use the STM32CUBEF4 HAL library to read out the sensor data with i2c?

岁酱吖の 提交于 2020-01-12 08:26:13
问题 I want to use the latest HAL library instead of Standard Peripheral Library. And i want to readout the BMA250E G-sensor's chip_id, but it doesn't work. Value of aRxBuffer always keep at 0x00. But it should be 0xf9! What's wrong in my code? ‪#‎include‬ "stm32f4xx_hal.h" #define I2Cx_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() #define I2Cx_SDA_PIN GPIO_PIN_9 #define I2Cx_SDA_GPIO_PORT GPIOB #define I2Cx_SDA_AF GPIO_AF4_I2C1 #define I2Cx_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()

Bad s_axi_bvalid, s_axi_wready, and s_axi_awready signals using Vivado IIC IP Flow

早过忘川 提交于 2020-01-06 19:40:36
问题 Im attempting to program an IIC Master Receiver with a Repeated Start. After writing the device address to the TX_FIFO s_axi_bvalid, s_axi_wready, and s_axi_awready are 'X'. I'm not sure whats happening. I've attached my timing diagram. Thanks for your help. DESIGN UNDER TEST module i2c_channel #( parameter CHANNEL_OUTPUT_WIDTH = 16 )( input clk, input reset, //the address of the slave; input [6:0] slave_address, //The width of the message expected from the slave at the specified address;

Bad s_axi_bvalid, s_axi_wready, and s_axi_awready signals using Vivado IIC IP Flow

拥有回忆 提交于 2020-01-06 19:39:32
问题 Im attempting to program an IIC Master Receiver with a Repeated Start. After writing the device address to the TX_FIFO s_axi_bvalid, s_axi_wready, and s_axi_awready are 'X'. I'm not sure whats happening. I've attached my timing diagram. Thanks for your help. DESIGN UNDER TEST module i2c_channel #( parameter CHANNEL_OUTPUT_WIDTH = 16 )( input clk, input reset, //the address of the slave; input [6:0] slave_address, //The width of the message expected from the slave at the specified address;

freescale imx6 with mpu9250

烂漫一生 提交于 2020-01-04 07:52:12
问题 I am trying to interface freescale imx6 SoC with mpu92/65 sensor device. I have taken mpu92/65 device driver from android (https://github.com/NoelMacwan/Kernel-10.4.1.B.0.101/tree/master/drivers/staging/iio/imu ) and have done necessary modifications to the driver and device tree. Device tree modifications: &i2c3{ ... extaccelerometer: mpu9250@68{ compatible = "mpu9250"; reg = <0x68>; interrupt-parent = <&gpio2>; interrupts = <9>; int_config = /bits/ 8 <0x00>; level_shifter = /bits/ 8 <0>;