#4. STM32F4 I2C Using Registers || Master mode || NO HAL ||

  Рет қаралды 24,026

ControllersTech

3 жыл бұрын

Purchase the Products shown in this video from :: controllerstech.store
________________________________________________________________________________________
I have tested the code for LCD 16x2, and it works pretty sweet. For those who want use it github.com/controllerstech/STM32/tree/master/LCD1602_I2C_NOHAL
I2C Receive using Registers kzfaq.info/get/bejne/j8mFl8dmudrcqZc.html
The Final code have all the functions from this video + from the I2C Receive video also. I have merged them both.
You can download the code and the PDF from controllerstech.com/stm32-i2c-configuration-using-registers/
Check out STM32 REGISTER BASED Playlist kzfaq.info/sun/PLfIJKC1ud8ghc4eFhI84z_3p3Ap2MCMV-
Check out more VIDEOS on I2C with STM32 kzfaq.info/sun/PLfIJKC1ud8gi_y7yQivRMi9RARPRE8fmh
________________________________________________________________________________________
******* SUPPORT US BY DONATING******
paypal.me/controllertech
*******Join the Membership*******
kzfaq.info/love/kdqtSMnhYuMsJkyHOxiPZQjoin
Join the Discord Server discord.gg/D32JE5wKyD
Join the Telegram Group t.me/controllerstechdiscuss
Follow me on Instagram controllerstech
For more info, visit www.controllerstech.com

Пікірлер: 87
@TheScythe2112
@TheScythe2112 2 жыл бұрын
This video is a lifesaver. I have to program an I2C master driver for an MC (a lpcxpresso 804) for university but struggled to understand all the steps in the provided example program. Though this shows a different MC, the steps are similar enough to help me understand what is going on. Have a drink on me. Thanks again!
@malleswaritippireddy1081
@malleswaritippireddy1081 3 жыл бұрын
Im glad to be here..... Excellent and waiting for upcoming videos on registers using multitasking using up mechanisms
@sumedhburbure4173
@sumedhburbure4173 3 жыл бұрын
Thank u for the video! Loving the register series!!
@jorgejacome4269
@jorgejacome4269 3 жыл бұрын
me too
@ControllersTech
@ControllersTech 3 жыл бұрын
Me too 😊
@eduardodelarosaferrer2205
@eduardodelarosaferrer2205 3 жыл бұрын
A very good tutorial, as always
@joecandoit5341
@joecandoit5341 3 жыл бұрын
You are a legend. Thanks for this. I did notice that website code is a little different in that you enable ACK in the I2C_Start() but I guess this does not matter having this or not in your example.
@ucontrolchannel5967
@ucontrolchannel5967 3 жыл бұрын
thank yo bro, I am going to make an example with MPU6050 by using your guide video.
@ludekspacek7101
@ludekspacek7101 2 жыл бұрын
Thank you, so much. Your tutorial help me everytime I need help :)
@ControllersTech
@ControllersTech 2 жыл бұрын
🙂
@huangsy910
@huangsy910 3 жыл бұрын
Great tutorial again. Thank you so much. Can you show us how to use STM32 to control (vary) the duty cycles of the 16 output channels of PCA9685?. I want to be able to set the duty cycle of each channel in a complex heater design.
@Pushpam1995
@Pushpam1995 3 жыл бұрын
Nucleo 64 f446RE is best board, I bought it buy watching your videos.
@trungpham704
@trungpham704 2 жыл бұрын
amazing tutorial sir
@mustafakayaduman6067
@mustafakayaduman6067 2 жыл бұрын
thank you from turkey
@bochraakrout7840
@bochraakrout7840 3 жыл бұрын
hello your course is very clear and useful I am really enjoying it. Can you please provide us a tutorial on the LIBJPEG plz
@ControllersTech
@ControllersTech 3 жыл бұрын
Maybe in the future.. no plans right now
@Pushpam1995
@Pushpam1995 3 жыл бұрын
Great video
@serg888fert4
@serg888fert4 3 жыл бұрын
hi. you doing nice job. thank you very much. please made video about CCD & stm32f103. example tsd1304. best regards.
@ozgurayik7181
@ozgurayik7181 3 жыл бұрын
Can you give an example for reading multi bytes from I2C ? (I need read_nack funtion for last byte)
@berrywhite1075
@berrywhite1075 3 жыл бұрын
Many thanks again , on the net these simple and great tutorial are missing... thank goodness you are there! Can I ask you ... what's you name? who is the good boy of 'Controllers Tech' ? 😉👍
@ControllersTech
@ControllersTech 3 жыл бұрын
You can join the telegram group to know more about me and to have some fun tech conversation 🙂
@berrywhite1075
@berrywhite1075 3 жыл бұрын
@@ControllersTech thanks 👍
@ilkeraykut7064
@ilkeraykut7064 3 жыл бұрын
Thank you for great tutorial sir.I have question.in which part of reference manuel or datasheet it says we have to configure I2C pins as Open -Drain?Thank you.
@ControllersTech
@ControllersTech 3 жыл бұрын
It doesn't say in the reference manual but I2C pins must be selected in the open drain mode. you can Google about the reason it's very long for me to write here
@ilkeraykut7064
@ilkeraykut7064 3 жыл бұрын
@@ControllersTech Thank you for repyling Before using F4 ,I was using f103c8 .in its manuel ,it says we have have to configure i2c pins that way but f4 manuel does not say .This is why I asked you.
@Shet_does
@Shet_does 4 ай бұрын
Hi so i was working on g474re series which has no ccr registers for i2ç instead it has timing register bit confusion with what formula to use here could you please provide some insights,
@ElettronicaRiparo
@ElettronicaRiparo 3 жыл бұрын
THK
@007Augs
@007Augs 3 жыл бұрын
Awesome content!!! In futures videos, could you do something with LoRa ? Regards from Argentina!!
@ControllersTech
@ControllersTech 3 жыл бұрын
I want to, but not able to get them. They are unavailable here. Once available, I'll buy..
@omercebeci5405
@omercebeci5405 3 жыл бұрын
Hello, there are some differences in registers with stm32g031k8 and stm32f4 ,How can I change my codes?
@kenwallace6493
@kenwallace6493 3 жыл бұрын
This is exactly what I have been looking for. Decoding HAL functions to get this info is grueling. Some devices (like STM32G474) cannot be done with uVision5 alone but require CubeMX which adds huge files/dependencies to the project. Would love to see that sorted out.
@ControllersTech
@ControllersTech 3 жыл бұрын
Yeah I agree. CubeMX generates some useless HAL codes, which are not needed anywhere. I will keep working on Register based tutorials. Although they are somewhat complicated to work with, since the proper steps are not provided by the ST
@noweare1
@noweare1 3 жыл бұрын
@@ControllersTech I had started with HAL but understand the hardware better by programming the registers directly. The LL drivers are register direct also plus the function document what your doing.
@vinothkannan1570
@vinothkannan1570 3 жыл бұрын
great
@liamferro7123
@liamferro7123 2 жыл бұрын
Thank you for your best tutorial ever! I have only one problem sir: When i activate one more timer in one pulse mode like the code behind , it dont put me the pwm2(pulses for triac) but give me 3,3V at output of the timer . When i cancel lcd init() it give me the pulse in output,,, what can i do? void TIM4Config (void) { RCC->APB1ENR |= (1SMCR = 0x0066; // Trigger-Mode, Timer input 2 TIM4->DIER = 0x0000; // Disable interrupts TIM4->SR = 0x0000; // Clear status register TIM4->EGR = 0x0000; // Clear event generation register TIM4->CCMR1 = 0x0178; // OC1: PWM2-Mode, Preload, IC2: IC2 on TI2 TIM4->CCMR2 = 0x0000; // OC3/OC4, IC3/IC4 off TIM4->CCER = TIM_CCER_CC1E; // OC1: On, AH; IC2: On, Both edges TIM4->CNT = 0; // Clear timer 1 counter TIM4->PSC = 168-1; // Set prescaler to 168 TIM4->ARR = 0x0000; // Initialize Auto-reload register TIM4->RCR = 0x0000; // Clear repetition counter TIM4->CCR1 = 0x0000; // Initialize Capture/Compare register 1 TIM4->CCR2 = 0x0000; // Clear Capture/Compare register 2 TIM4->CCR3 = 0x0000; // Clear Capture/Compare register 3 TIM4->CCR4 = 0x0000; // Clear Capture/Compare register 4 TIM4->BDTR = 0x8000; // Main output enable TIM4->DCR = 0x0000; // Clear DMA configuration (DMA not needed) TIM4->CR1 |= 0x0001; // Timer 4 Enable GPIOD->MODER = 0x0A000000; // Enable PD12/PD13 alternate function mode GPIOD->AFR[1] = 0x00220000; // Select PD12/PD13 alternate function AF2 GPIOD->AFR[0] = 0x00000000; // Clear AFRL GPIOD->OTYPER = 0x00000000; // Set all outputs to push-pull mode (default) GPIOD->OSPEEDR = 0x00000000; // Set all outputs to low-speed (default) GPIOD->PUPDR = 0x00000000; // Disable all pull-ups and pull-down } PLEASE HELP!
@vlad_kach_
@vlad_kach_ 3 жыл бұрын
So setting i2c is just a sending binary code via pins
@vinothkannan1570
@vinothkannan1570 3 жыл бұрын
make one video for CAN protocol also
@laughandlearnkck1323
@laughandlearnkck1323 Жыл бұрын
sir my start bit is set but my SB bit is not set it goes in a loop can you please give me a solution
@sharana.p6161
@sharana.p6161 3 жыл бұрын
Thank you so much. I have seen the I2C read also. So, how to read this module through I2C. Please, help.
@ControllersTech
@ControllersTech 3 жыл бұрын
Check the datasheet of the module, if it allows the read or not. If it does, simply read from those registers.
@leanh1203
@leanh1203 3 жыл бұрын
hi sir, could you please explain for me why you don't enable the Acknowledge bit in I2C->CR1 register? Thank you so much, your videos help me a lot in my study.
@ControllersTech
@ControllersTech 3 жыл бұрын
You can use it.. I Didn't feel the necessity in tx mode. I have used it in the Rx mode.. check out that video.
@leanh1203
@leanh1203 3 жыл бұрын
I'm using the STM32F411E-Discovery board.
@MirusWoozy
@MirusWoozy 2 жыл бұрын
I'm trying the code, following from the very beginning as you showed us in the first video. In the debugging phase I follow the code and it stops at the function I2C_Address, "while (!(I2C1->SR1 & (1
@AlfaFatansyah
@AlfaFatansyah Жыл бұрын
same bro, please anyone help?
@josuebc8991
@josuebc8991 2 ай бұрын
did you manage to solve it?
@nazifahadlina7038
@nazifahadlina7038 3 жыл бұрын
hi! i really love this tutorial. and i have a question, if i wanna use this method for lcd 16x2, how can i control the cursor and also how can i use string to display my output on lcd?
@ControllersTech
@ControllersTech 3 жыл бұрын
see the lcd16x2 using i2c video change the hal i2c function with your own function
@fransanabria1458
@fransanabria1458 3 жыл бұрын
@@ControllersTech Hi, how can I create my own function to replace hal i2c function?, thanks
@ControllersTech
@ControllersTech 3 жыл бұрын
Check out the i2c video in the register based series playlist
@fransanabria1458
@fransanabria1458 3 жыл бұрын
​@@ControllersTech Hello, thanks for answering so quickly, yes! I already saw that video and tried to integrate the lcd library with i2c of the video where cubemx is used, but I don't know how I should change the function of HAL_I2C_Master_Transmit, for one that allows me to use the lcd, with the i2c settings of the register based series playlist, thanks,I really appreciate your help
@ControllersTech
@ControllersTech 3 жыл бұрын
github.com/controllerstech/STM32/tree/master/LCD1602_I2C_NOHAL
@MrHause13
@MrHause13 3 жыл бұрын
Hi, great job again! You made a FreeRTOS tutorial using CubeMX. Could you maybe show how to add FreeRTOS to the clear project and then configure stm? I think it would be a great a video!
@ControllersTech
@ControllersTech 3 жыл бұрын
Sure will do that
@vlad_kach_
@vlad_kach_ 3 жыл бұрын
Good code commenting 👍🏽
@ilkeraykut7064
@ilkeraykut7064 2 жыл бұрын
I used pll too.So Can we write lower value than APB1 frequency? let s say APB1 48 mhz and Can we write 8 to the FREQ bits?
@ControllersTech
@ControllersTech 2 жыл бұрын
Can u explain it a little more clearly
@tinkererofuniverse7685
@tinkererofuniverse7685 5 ай бұрын
I2C characteristics say only Standard-mode (Sm): with a bit rate up to 100 kbit/s Fast-mode (Fm): with a bit rate up to 400 kbit/s there is no tw(sclh) and tr(scl) for stm32f407vgt6 how can ı find CCR and TRİSE for FM adn SM
@ControllersTech
@ControllersTech 5 ай бұрын
it must be somewhere in the electrical characteristics in the datasheet (Not reference manual).
@girlswithgames
@girlswithgames 9 ай бұрын
music slaps
@ozgurayik7181
@ozgurayik7181 3 жыл бұрын
why did not you read ACK bit after writting address? When I try to do it and analyz on logic analyzer ,I can see only device address and NACK bitç
@ControllersTech
@ControllersTech 3 жыл бұрын
because i knew my address was correct.
@erkamkocaer2097
@erkamkocaer2097 3 жыл бұрын
How did you read device address after cheking ACK bit could you explain? @Ozgur Ayik
@sehaaltnkaynak9327
@sehaaltnkaynak9327 3 жыл бұрын
Hello , why do we use ---volatile uint32_t * data---- rather than * uint8_t ? Data register sizes is 8 bit. I dont get it. Thanks for this great tutorial.
@ControllersTech
@ControllersTech 3 жыл бұрын
Where ?
@sehaaltnkaynak9327
@sehaaltnkaynak9327 3 жыл бұрын
@@ControllersTech At 23.32 in i2c_Write_Multi function
@ControllersTech
@ControllersTech 3 жыл бұрын
you can use uint8_t. I don't know why i used that one.. DR is a 8 bit register, so uint8_t is good enough..
@sehaaltnkaynak9327
@sehaaltnkaynak9327 3 жыл бұрын
@@ControllersTech I appreciate for your response . Have a nice day.
@slawekh7862
@slawekh7862 3 жыл бұрын
What about receiving bytes in master mode?
@ControllersTech
@ControllersTech 3 жыл бұрын
Soon
@muhammadfaisal-ko3bn
@muhammadfaisal-ko3bn 6 ай бұрын
what ide software you are using to program the stm32 board in this video?
@ControllersTech
@ControllersTech 6 ай бұрын
Keil microvision.
@muhammadfaisal-ko3bn
@muhammadfaisal-ko3bn 6 ай бұрын
@@ControllersTech Oh yeah, and how'd you plug the stm, using st-link?
@ControllersTech
@ControllersTech 6 ай бұрын
You can't. Some of the boards do come with an additional usb (user usb). If yours don't, connect an additional usb using IO pins.
@muhammadfaisal-ko3bn
@muhammadfaisal-ko3bn 6 ай бұрын
@@ControllersTech okay, thank you sir
@abdullahejaz6571
@abdullahejaz6571 3 жыл бұрын
I am using same components but getting AF set after sending the address.......!
@ControllersTech
@ControllersTech 3 жыл бұрын
Maybe address is wrong.
@azmainfaiak8111
@azmainfaiak8111 Ай бұрын
4:13
@mprone
@mprone 3 жыл бұрын
Do people actually code like this? It looks so hard without builtin functions...
@ControllersTech
@ControllersTech 3 жыл бұрын
It is hard... But you have more control over things. Also the code size is way smaller.
@labgsm8185
@labgsm8185 3 жыл бұрын
@@ControllersTech Nice work, looking forward for new videos Thank you
@vinothkannan1570
@vinothkannan1570 3 жыл бұрын
make one video with spi sd card module
@ControllersTech
@ControllersTech 3 жыл бұрын
there already is one. Check STM32 playlist
@vinothkannan1570
@vinothkannan1570 3 жыл бұрын
@@ControllersTech thanks but i am looking for without HAL ,register level programming
@murugesanraj4462
@murugesanraj4462 7 ай бұрын
Thank you, but i need I2C_LCD register code explain
@harrys_potter
@harrys_potter 3 ай бұрын
SMBUS ???? I2C1->CR1|=1
Now THIS is entertainment! 🤣
00:59
America's Got Talent
Рет қаралды 35 МЛН
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 4,1 МЛН
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 118 МЛН
Samsung Galaxy 🔥 #shorts  #trending #youtubeshorts  #shortvideo ujjawal4u
0:10
Ujjawal4u. 120k Views . 4 hours ago
Рет қаралды 8 МЛН
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 2 МЛН
OZON РАЗБИЛИ 3 КОМПЬЮТЕРА
0:57
Кинг Комп Shorts
Рет қаралды 1,8 МЛН
Look, this is the 97th generation of the phone?
0:13
Edcers
Рет қаралды 3 МЛН