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!
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.
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
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.
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
@@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.
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.
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
@@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.
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,
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' ? 😉👍
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.
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
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!
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.
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.
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 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
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!
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!
Thank u for the video! Loving the register series!!
me too
Me too 😊
Im glad to be here..... Excellent and waiting for upcoming videos on registers using multitasking using up mechanisms
A very good tutorial, as always
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.
thank yo bro, I am going to make an example with MPU6050 by using your guide video.
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
same bro, please anyone help?
did you manage to solve it?
Nucleo 64 f446RE is best board, I bought it buy watching your videos.
Thank you, so much. Your tutorial help me everytime I need help :)
🙂
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.
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
@@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.
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.
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
@@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.
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,
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' ? 😉👍
You can join the telegram group to know more about me and to have some fun tech conversation 🙂
@@ControllersTech thanks 👍
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.
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
it must be somewhere in the electrical characteristics in the datasheet (Not reference manual).
Hello, there are some differences in registers with stm32g031k8 and stm32f4 ,How can I change my codes?
So setting i2c is just a sending binary code via pins
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
Thank you so much. I have seen the I2C read also. So, how to read this module through I2C. Please, help.
Check the datasheet of the module, if it allows the read or not. If it does, simply read from those registers.
Can you give an example for reading multi bytes from I2C ? (I need read_nack funtion for last byte)
hello your course is very clear and useful I am really enjoying it. Can you please provide us a tutorial on the LIBJPEG plz
Maybe in the future.. no plans right now
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ç
because i knew my address was correct.
How did you read device address after cheking ACK bit could you explain? @Ozgur Ayik
what ide software you are using to program the stm32 board in this video?
Keil microvision.
@@ControllersTech Oh yeah, and how'd you plug the stm, using st-link?
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.
@@ControllersTech okay, thank you sir
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?
Can u explain it a little more clearly
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!
thank you from turkey
I am using same components but getting AF set after sending the address.......!
Maybe address is wrong.
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.
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.
I'm using the STM32F411E-Discovery board.
Awesome content!!! In futures videos, could you do something with LoRa ? Regards from Argentina!!
I want to, but not able to get them. They are unavailable here. Once available, I'll buy..
What about receiving bytes in master mode?
Soon
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.
Where ?
@@ControllersTech At 23.32 in i2c_Write_Multi function
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..
@@ControllersTech I appreciate for your response . Have a nice day.
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?
see the lcd16x2 using i2c video
change the hal i2c function with your own function
@@ControllersTech Hi, how can I create my own function to replace hal i2c function?, thanks
Check out the i2c video in the register based series playlist
@@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
github.com/controllerstech/STM32/tree/master/LCD1602_I2C_NOHAL
hi.
you doing nice job. thank you very much.
please made video about CCD & stm32f103. example tsd1304.
best regards.
amazing tutorial sir
make one video for CAN protocol also
Do people actually code like this? It looks so hard without builtin functions...
It is hard... But you have more control over things. Also the code size is way smaller.
@@ControllersTech Nice work, looking forward for new videos Thank you
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!
Sure will do that
Great video
make one video with spi sd card module
there already is one. Check STM32 playlist
@@ControllersTech thanks but i am looking for without HAL ,register level programming
THK
Thank you, but i need I2C_LCD register code explain
great
Good code commenting 👍🏽
4:13
SMBUS ???? I2C1->CR1|=1
music slaps