43. STM32CubeIDE Ultrasonic Distance Sensor. HC-SR04 / OLED with STM32F103C8T6

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ส.ค. 2021
  • STM32 Blue Pill for beginners
    Code and diagram are at www.micropeta.com/video43

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

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

    In this video I set Clock Configuration tab → HCLK (MHz) to 72
    You can set the speed of STM32 to any value you want up-to maximum of 72 for STM32F103C8T6. Most of the time 72 is better.
    I set prescaler to 71
    The reason is
    I needed to measure micro-seconds for the sensor
    Time = 1 / Frequency
    1 us = 1 / 1MHz
    To have micro-second, timer frequency needs to be 1MHz.
    Because I already set clock to 72MHz, I need to divide it by 72 for timer frequency.
    You can divide it using prescalor
    Prescalor is always one less so it is 71
    Another example: If you set clock to 64MHz, you need to divide it by 64 for timer frequency.
    Prescalor is 63

  • @vinodkinoni4863
    @vinodkinoni4863 2 ปีที่แล้ว +1

    nice work thanks so lot for your hard work

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

    Thank you so much, it worked for the STM32-L476RG, I just had to change #include "stm32f1xx_hal.h" to #include "stm32l4xx_hal.h" on the libraries.

  • @sanjeewaalahakone4324
    @sanjeewaalahakone4324 2 ปีที่แล้ว +1

    Thank you, Nizar

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

    I am doing this project on STM32F401RE.the code runs fine but when i debug it shows me the error. Error message from debugger back end:
    Error erasing flash with vFlashErase packet.

  • @sardarwaqas458
    @sardarwaqas458 20 วันที่ผ่านมา

    Es Koo run krtaa ha aur stm board par transfer krta ha too nehe hota kata ha stm link is not recognize kindly help

  • @ISABELAMARYSASAKIESILVA
    @ISABELAMARYSASAKIESILVA 2 หลายเดือนก่อน

    i love you

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

    how to debug on keil C, power supply from ST link is 3.3V so when plugging in 5V pin on stm32 the voltage is only 3.3V, so hcsr04 module not working, please help me

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

      Before connecting st-link, supply 5v via usb.
      Or, you can connect 5v (vcc) and gnd to +/- of separate 5v source

    • @khoinguyenes3423
      @khoinguyenes3423 2 ปีที่แล้ว +1

      @@NizarMohideen I power separately for Hc Sr04 module, power stm32 via STlink and then connect to common ground, will my computer be damaged when supplying 2 sources at the same time? I'm a newbie

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

      The computer will be fine as long as you supply 5V or less to any sensors.
      For more information about safety, please watch video no 51 or 52 in my TH-cam channel
      th-cam.com/video/Ga2lfBq9zaE/w-d-xo.html
      th-cam.com/video/TeAa6UPIb-c/w-d-xo.html

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

    Sir one request can you plz interface ultrasonic sensor with smt32 to control the brushless motor, if you have code plz send me

    • @NizarMohideen
      @NizarMohideen  2 ปีที่แล้ว +1

      I am sorry I don't have a brushless motor with me at the moment

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

      Ok sir

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

    Can i get hex file of this Project?plz

    • @NizarMohideen
      @NizarMohideen  หลายเดือนก่อน +1

      I am sorry. I don't have the hex file with me
      You can make one using STM32CubeIDE

    • @bbsvampire3079
      @bbsvampire3079 29 วันที่ผ่านมา

      @@NizarMohideen Errors occuring in this code on my device

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

    demoxe\demoxe.axf: Error: L6218E: Undefined symbol SSD1306_Init (referred from main.o). help me please