You are still a legend. Now I understand why the ACK enable is there. You are on my "if I ever make money with this stuff, I am sending you some" list lol.
Thanks for your tutorials! They are of great help to me. Why don't you use your own built-in functions? For example, Step 2.a) and 2.b) together are the same as the I2C_Address(addr) function.
Good afternoon Thank you so much for your lessons! I spent 2 days writing code to receive data over I2C. Everything was good except... after receiving bytes, my MASTER RECEIVER do not send ASK! I spent 2 days! nothing helped! Your lesson helped! Thank you! My question is: you changed the I2C_Start procedure, namely, you added I2C1->CR1 |=(1
Great stuff as usual. Thank you so much! I can't read any changing value from the MPU6050. Do I need to connect SDA and SCL to propers pull-up resistors?
The I2C works for me: I can see on the oscilloscope how every second the while loop is executed. But in the watch Ax, Ay and Az are at 0. In the oscilloscope I can see the signal perfectly: How the master sends the sequence: address, write, ACK(from the slave), register, ACK(from the slave), address, read, ACK(from the slave)... but from then on the acerometer only sends zeros. I thought that the accelerometer did not work well, but I have tested it with an arduino uno and it works perfectly.
Hi I used this code on STM32F407 since the registers are pretty much the same. But in my mcu the SB bit doesn't get set. The code gets stuck there. Any suggestions?
@@ControllersTech I mean the ACC_OUT_L, I thought it only read the HIGH value ( ACC_OUT_H at register 15:8 bits). But after a couple of minutes rewatching your code, I figured out that It reads the LOW values (7:0 bits) also. Thanks for replying anyways
Hey, do u have some Tutorial about I2C on FreeRTOS with communicate LCD Display? i can send some lcd_init() but not completely, trying it witch void lcd (void *argument) { lcd_init()} and creat_lcd_task(lcd,"lcd,",512,Null,1,Null)
Hi Good evening!!! Can you please do a video on Data transfer through i2c communication between 2 stm32f407discovery boards in stmcubeide without hal functions pleaseeee
if i want to use different SCL and SDA PINS for I2C, is there a way to configure them? meaning i don't want to use PA8 and PA9 pins but some other GPIOs for I2C. how to configure different GPIOs as SCL and SDA pins for a given I2C (let us say I2C1)?
@@ControllersTech so this is in different video of yours. th-cam.com/video/usvAIEdp_I8/w-d-xo.html So i can configure any pin to be i2c taking reference from this part of your video?
As per the datasheet, the address is b110100X (X is for AD0). This address is 7 bit long. STM32 needs 8 bit Address for the I2C, So b110100XW (Here W is Write(0) or Read(1) But). basically b11010000, 0xD0
There is something wrong in my code because when I trying to work MPU_Write(MPU6050_ADDR, PWR_MGMT_1_REG, Data); the code got stuck into this void I2C_Address(uint8_t Address) function's while loop. How can I fix this situation?
Thanks for sharing your knowledge! It is helping me a lot. I think the second step can be done more compactly like this: //2.- else { //2.a) and b) I2C_Address(addr);
Hi!! I'm writing from Argentina.. I found this channel and it's gold! I really enjoy your videos. Saludos y sigue así!
You are still a legend. Now I understand why the ACK enable is there. You are on my "if I ever make money with this stuff, I am sending you some" list lol.
Yeah.. i have mixed both tx and rx. It's always better to use Ack even with tx only.
Amazing! It would be nice if you make a video using registers to control an spi lcd tft screen
can you make a video about using lora module ?
Thanks for your tutorials! They are of great help to me.
Why don't you use your own built-in functions? For example, Step 2.a) and 2.b) together are the same as the I2C_Address(addr) function.
Good afternoon Thank you so much for your lessons!
I spent 2 days writing code to receive data over I2C. Everything was good except...
after receiving bytes, my MASTER RECEIVER do not send ASK! I spent 2 days! nothing helped!
Your lesson helped! Thank you!
My question is: you changed the I2C_Start procedure, namely, you added I2C1->CR1 |=(1
Isn't ACK a common practice in communication ?
I didn't knew about it. CR Register had an option to enable it, so I did.
Great stuff as usual. Thank you so much! I can't read any changing value from the MPU6050. Do I need to connect SDA and SCL to propers pull-up resistors?
Yes it's always recommended
The I2C works for me: I can see on the oscilloscope how every second the while loop is executed. But in the watch Ax, Ay and Az are at 0.
In the oscilloscope I can see the signal perfectly: How the master sends the sequence: address, write, ACK(from the slave), register, ACK(from the slave), address, read, ACK(from the slave)... but from then on the acerometer only sends zeros.
I thought that the accelerometer did not work well, but I have tested it with an arduino uno and it works perfectly.
Hi I used this code on STM32F407 since the registers are pretty much the same. But in my mcu the SB bit doesn't get set. The code gets stuck there. Any suggestions?
Hi!
I would like to know how to implement DMA to read acceleration through I2C?. I used HAL library but doesn’t work fine :( .
Does the MPU_Read() function do the reading Low value of gyro or accel register also? Thanks in advance.
What do you mean low value ?
@@ControllersTech I mean the ACC_OUT_L, I thought it only read the HIGH value ( ACC_OUT_H at register 15:8 bits). But after a couple of minutes rewatching your code, I figured out that It reads the LOW values (7:0 bits) also. Thanks for replying anyways
first of all it is very nice, which pins on MPU6050 are connected to which pins on STM ?
I2c pins. Clock to clock and data to data..
See the mpu6050 detailed tutorial for that..
Search on the website or youtube
@@ControllersTech No, you got it wrong. Which pins of the SCL,SDA nucleo do I connect? I asked?
@@ControllersTech more precisely the wiring diagram
Did you watch the previous video ? About I2C send data
The pin configuration is defined there. I said in the video that you must watch that one first
@@ControllersTech unfortunately :( Can you leave the link?
Hey, do u have some Tutorial about I2C on FreeRTOS with communicate LCD Display? i can send some lcd_init() but not completely, trying it witch void lcd (void *argument) { lcd_init()} and creat_lcd_task(lcd,"lcd,",512,Null,1,Null)
what is the buffer size if i want to read 2 bytes of data
2 🤷
How can i receive the data from another controller through i2c bus?
Hi Good evening!!! Can you please do a video on Data transfer through i2c communication between 2 stm32f407discovery boards in stmcubeide without hal functions pleaseeee
if i want to use different SCL and SDA PINS for I2C, is there a way to configure them?
meaning i don't want to use PA8 and PA9 pins but some other GPIOs for I2C. how to configure different GPIOs as SCL and SDA pins for a given I2C (let us say I2C1)?
Its shown in the video.
@@ControllersTech so this is in different video of yours.
th-cam.com/video/usvAIEdp_I8/w-d-xo.html
So i can configure any pin to be i2c taking reference from this part of your video?
Not any pins, the pins which support I2C. You can check that in the datasheet of your controller.
can you explain why you have set MPU6050_ADDR as 0xD0(line 27) where as in the datasheet its given as 0x68/0x69 depending on AD0 value
As per the datasheet, the address is b110100X (X is for AD0). This address is 7 bit long.
STM32 needs 8 bit Address for the I2C, So b110100XW (Here W is Write(0) or Read(1) But). basically b11010000, 0xD0
@@ControllersTech basically 0x68
yes
Fantastic. Subscribed.
İt is great video but SB flag bit is never set, why? Thanks for help
How do transfer data from the buffer memory to the PC?
Use uart.. it's the easiest way
@@ControllersTech I tried but not getting that.... Have you posted any videos related to buffer memory?
There is something wrong in my code because when I trying to work MPU_Write(MPU6050_ADDR, PWR_MGMT_1_REG, Data);
the code got stuck into this void I2C_Address(uint8_t Address) function's while loop. How can I fix this situation?
It's exactly my situation. If you solved this issue, do you remember how? Thank you so much!
love you!!!!!!!
Thank You very much)))))
ur using keil.
Thank you great
good video,and I hope you can make a tutorial about how to calculate pitch,yaw and roll angle😄
Thanks for sharing your knowledge! It is helping me a lot.
I think the second step can be done more compactly like this:
//2.-
else
{
//2.a) and b)
I2C_Address(addr);
//2.c), d), e), f) and g)
while(remaining)
{
while(!(I2C1->SR1 & I2C_SR1_RXNE)); //2.c)
buff[size - remaining] = I2C1->DR; //2.d)
if(remaining > 2)
{
I2C1->CR1 |= I2C_CR1_ACK; //2.e)
remaining--;
}
else if(remaining > 1)
{
I2C1->CR1 &= ~I2C_CR1_ACK; //2.f)
I2C_Stop(); //2.g)
remaining--;
}
else
{
remaining--;
}
}
}
does your function operate ok ?