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

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 พ.ย. 2024

ความคิดเห็น • 87

  • @TheScythe2112
    @TheScythe2112 2 ปีที่แล้ว +6

    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!

  • @sumedhburbure4173
    @sumedhburbure4173 4 ปีที่แล้ว +5

    Thank u for the video! Loving the register series!!

  • @malleswaritippireddy1081
    @malleswaritippireddy1081 3 ปีที่แล้ว

    Im glad to be here..... Excellent and waiting for upcoming videos on registers using multitasking using up mechanisms

  • @eduardodelarosaferrer2205
    @eduardodelarosaferrer2205 4 ปีที่แล้ว +4

    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 4 ปีที่แล้ว +2

    thank yo bro, I am going to make an example with MPU6050 by using your guide video.

  • @MirusWoozy
    @MirusWoozy 3 ปีที่แล้ว +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 ปีที่แล้ว +1

      same bro, please anyone help?

    • @josuebc8991
      @josuebc8991 6 หลายเดือนก่อน

      did you manage to solve it?

  • @Pushpam1995
    @Pushpam1995 4 ปีที่แล้ว

    Nucleo 64 f446RE is best board, I bought it buy watching your videos.

  • @ludekspacek7101
    @ludekspacek7101 3 ปีที่แล้ว

    Thank you, so much. Your tutorial help me everytime I need help :)

  • @ilkeraykut7064
    @ilkeraykut7064 3 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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.

  • @kenwallace6493
    @kenwallace6493 4 ปีที่แล้ว

    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  4 ปีที่แล้ว

      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.

  • @Shet_does
    @Shet_does 8 หลายเดือนก่อน

    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,

  • @berrywhite1075
    @berrywhite1075 4 ปีที่แล้ว

    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  4 ปีที่แล้ว

      You can join the telegram group to know more about me and to have some fun tech conversation 🙂

    • @berrywhite1075
      @berrywhite1075 4 ปีที่แล้ว

      @@ControllersTech thanks 👍

  • @huangsy910
    @huangsy910 3 ปีที่แล้ว +1

    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.

  • @tinkererofuniverse7685
    @tinkererofuniverse7685 9 หลายเดือนก่อน

    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  9 หลายเดือนก่อน

      it must be somewhere in the electrical characteristics in the datasheet (Not reference manual).

  • @omercebeci5405
    @omercebeci5405 3 ปีที่แล้ว

    Hello, there are some differences in registers with stm32g031k8 and stm32f4 ,How can I change my codes?

  • @vlad_kach_
    @vlad_kach_ 3 ปีที่แล้ว

    So setting i2c is just a sending binary code via pins

  • @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.

  • @ozgurayik7181
    @ozgurayik7181 3 ปีที่แล้ว

    Can you give an example for reading multi bytes from I2C ? (I need read_nack funtion for last byte)

  • @bochraakrout7840
    @bochraakrout7840 4 ปีที่แล้ว

    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  4 ปีที่แล้ว

      Maybe in the future.. no plans right now

  • @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

  • @muhammadfaisal-ko3bn
    @muhammadfaisal-ko3bn 10 หลายเดือนก่อน

    what ide software you are using to program the stm32 board in this video?

    • @ControllersTech
      @ControllersTech  10 หลายเดือนก่อน

      Keil microvision.

    • @muhammadfaisal-ko3bn
      @muhammadfaisal-ko3bn 10 หลายเดือนก่อน

      @@ControllersTech Oh yeah, and how'd you plug the stm, using st-link?

    • @ControllersTech
      @ControllersTech  10 หลายเดือนก่อน

      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 10 หลายเดือนก่อน

      @@ControllersTech okay, thank you sir

  • @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

  • @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!

  • @mustafakayaduman6067
    @mustafakayaduman6067 2 ปีที่แล้ว

    thank you from turkey

  • @abdullahejaz6571
    @abdullahejaz6571 3 ปีที่แล้ว

    I am using same components but getting AF set after sending the address.......!

  • @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 ปีที่แล้ว +1

      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.

  • @007Augs
    @007Augs 4 ปีที่แล้ว

    Awesome content!!! In futures videos, could you do something with LoRa ? Regards from Argentina!!

    • @ControllersTech
      @ControllersTech  4 ปีที่แล้ว +1

      I want to, but not able to get them. They are unavailable here. Once available, I'll buy..

  • @slawekh7862
    @slawekh7862 3 ปีที่แล้ว

    What about receiving bytes in master mode?

  • @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.

  • @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

  • @serg888fert4
    @serg888fert4 4 ปีที่แล้ว

    hi.
    you doing nice job. thank you very much.
    please made video about CCD & stm32f103. example tsd1304.
    best regards.

  • @trungpham704
    @trungpham704 3 ปีที่แล้ว

    amazing tutorial sir

  • @vinothkannan1570
    @vinothkannan1570 4 ปีที่แล้ว

    make one video for CAN protocol also

  • @mprone
    @mprone 4 ปีที่แล้ว

    Do people actually code like this? It looks so hard without builtin functions...

    • @ControllersTech
      @ControllersTech  4 ปีที่แล้ว +1

      It is hard... But you have more control over things. Also the code size is way smaller.

    • @labgsm8185
      @labgsm8185 4 ปีที่แล้ว

      @@ControllersTech Nice work, looking forward for new videos Thank you

  • @MrHause13
    @MrHause13 4 ปีที่แล้ว

    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!

  • @Pushpam1995
    @Pushpam1995 4 ปีที่แล้ว

    Great video

  • @vinothkannan1570
    @vinothkannan1570 4 ปีที่แล้ว

    make one video with spi sd card module

    • @ControllersTech
      @ControllersTech  4 ปีที่แล้ว

      there already is one. Check STM32 playlist

    • @vinothkannan1570
      @vinothkannan1570 4 ปีที่แล้ว

      @@ControllersTech thanks but i am looking for without HAL ,register level programming

  • @ElettronicaRiparo
    @ElettronicaRiparo 4 ปีที่แล้ว

    THK

  • @murugesanraj4462
    @murugesanraj4462 10 หลายเดือนก่อน

    Thank you, but i need I2C_LCD register code explain

  • @vinothkannan1570
    @vinothkannan1570 4 ปีที่แล้ว

    great

  • @vlad_kach_
    @vlad_kach_ 3 ปีที่แล้ว

    Good code commenting 👍🏽

  • @azmainfaiak8111
    @azmainfaiak8111 5 หลายเดือนก่อน

    4:13

  • @harrys_potter
    @harrys_potter 7 หลายเดือนก่อน

    SMBUS ???? I2C1->CR1|=1

  • @girlswithgames
    @girlswithgames ปีที่แล้ว

    music slaps