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

Поделиться
HTML-код
  • Опубликовано: 22 окт 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

  • @ucontrolchannel5967
    @ucontrolchannel5967 4 года назад +2

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

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

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

  • @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 5 месяцев назад

      did you manage to solve it?

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

  • @Pushpam1995
    @Pushpam1995 4 года назад

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

  • @Shet_does
    @Shet_does 7 месяцев назад

    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,

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

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

  • @eduardodelarosaferrer2205
    @eduardodelarosaferrer2205 4 года назад +4

    A very good tutorial, as always

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

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

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

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

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

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

  • @tinkererofuniverse7685
    @tinkererofuniverse7685 8 месяцев назад

    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  8 месяцев назад

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

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

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

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

  • @muhammadfaisal-ko3bn
    @muhammadfaisal-ko3bn 9 месяцев назад

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

    • @ControllersTech
      @ControllersTech  9 месяцев назад

      Keil microvision.

    • @muhammadfaisal-ko3bn
      @muhammadfaisal-ko3bn 9 месяцев назад

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

    • @ControllersTech
      @ControllersTech  9 месяцев назад

      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 9 месяцев назад

      @@ControllersTech okay, thank you sir

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

  • @vinothkannan1570
    @vinothkannan1570 3 года назад

    make one video for CAN protocol also

  • @serg888fert4
    @serg888fert4 4 года назад

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

  • @ludekspacek7101
    @ludekspacek7101 3 года назад

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

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

  • @abdullahejaz6571
    @abdullahejaz6571 3 года назад

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

  • @trungpham704
    @trungpham704 3 года назад

    amazing tutorial sir

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

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

  • @ElettronicaRiparo
    @ElettronicaRiparo 4 года назад

    THK

  • @mustafakayaduman6067
    @mustafakayaduman6067 2 года назад

    thank you from turkey

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

  • @vinothkannan1570
    @vinothkannan1570 3 года назад

    great

  • @Pushpam1995
    @Pushpam1995 4 года назад

    Great video

  • @murugesanraj4462
    @murugesanraj4462 10 месяцев назад

    Thank you, but i need I2C_LCD register code explain

  • @azmainfaiak8111
    @azmainfaiak8111 5 месяцев назад

    4:13

  • @vlad_kach_
    @vlad_kach_ 3 года назад

    Good code commenting 👍🏽

  • @harrys_potter
    @harrys_potter 6 месяцев назад

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

  • @girlswithgames
    @girlswithgames Год назад

    music slaps