88. STM32CubeIDE RFID RC522 Module with STM32F103C8T6

Поделиться
HTML-код
  • Опубликовано: 10 июл 2024
  • STM32 Blue Pill for beginners
    Code and diagram are at www.micropeta.com/video88

Комментарии • 51

  • @mertoguzhan8814
    @mertoguzhan8814 3 месяца назад +2

    Thank you so much such a helpful tutorial.

  • @soranfatah1033
    @soranfatah1033 4 месяца назад +2

    Thanks nice project ...🎉🎉🎉

  • @user-lr6gl9fq7j
    @user-lr6gl9fq7j 4 месяца назад

    In clock configuration, you have set the prescaler as 2. Does it work on other prescaler? If so, should I need to make any changes in the .c and .h files?

    • @NizarMohideen
      @NizarMohideen  4 месяца назад +1

      If you have different clock speed, you can change the prescaler in SPI but the baud rate should be around 9MBit. No need to change .c and .h files

  • @Hisham171
    @Hisham171 3 месяца назад

    My status variable sometimes is 2 and sometimes is 1. It never be 0. How to fix this issue? I am using STM32F0.

  • @jaiakash4416
    @jaiakash4416 3 месяца назад

    It shows error reading variable how to fix? Please help

  • @devagyabudhiraja1150
    @devagyabudhiraja1150 2 месяца назад +1

    Hello! I am using STM32F303VCT6 discovery board, I want to use the RFID sensor and on following your steps and since I am using the STM32f3 version, on changing the include files and fixing up some minor errors when I run it, on Live Expressions I cant see the sNum string I can only see the first two that are fixed (147, 32) but the rest 3 numbers are 0 and are not updating when I bring another card? Could you help me what I can do to make this work??

    • @NizarMohideen
      @NizarMohideen  2 месяца назад

      Thanks for trying my codes.
      I hope you have figured out the reason
      Please make sure the rfid cards are good

    • @giuseppemazzocca9813
      @giuseppemazzocca9813 Месяц назад

      i have the same problem, do you have find a solution?🙏

    • @devagyabudhiraja1150
      @devagyabudhiraja1150 Месяц назад +2

      @@giuseppemazzocca9813 I had fixed the problem using HAL, I restructured the code and wrote it again in the main file and it started working!!

    • @devagyabudhiraja1150
      @devagyabudhiraja1150 Месяц назад +2

      @@user-seojihye71 The way I am doing it is that the main function enters in a while loop where it continually checks for the presence of an RFID card using the MFRC522_Request function. When a card is detected, it reads the card's UID using the MFRC522_Anticoll function and compares it with a pre-stored UID. If the UID matches, an LED connected to GPIO that I included as pin PA8 is turned on; otherwise, the LED is turned off.
      The LED connected to GPIO pin PC13 toggles state to provide feedback each time a card is detected. If no card is detected within a specified period, I am setting it to reset after a second or two.
      Make sure that you don't change anything in the h and c file that was provided in the video but on changing the main file like above it started working!

    • @user-seojihye71
      @user-seojihye71 28 дней назад

      ​@@devagyabudhiraja1150 Thank you so much. Thanks to you, I was able to finish the work for a long time. Thank you so much

  • @benmahmoudramla9121
    @benmahmoudramla9121 4 месяца назад

    hello , im working on stm32MP157f-K2 and i need the rfid reader library but im not sure that the library you have provided in the video would work in my project ? any help please ?

    • @NizarMohideen
      @NizarMohideen  4 месяца назад +2

      It should work
      I tested this library with STM32F446RE Nucleo and STM32F411CE also, it worked!
      All I had to change was to edit rc522.h
      line1 #include "stm32f1xx_hal.h" to #include "stm32f4xx_hal.h"
      Lines 10-15 (According to pins settings)
      #define HSPI_INSTANCE &hspi1
      #define MFRC522_CS_PORT GPIOA
      #define MFRC522_CS_PIN GPIO_PIN_4
      #define MFRC522_RST_PORT GPIOB
      #define MFRC522_RST_PIN GPIO_PIN_0
      Clock configurations does not effect but I had to set the Prescalor in SPI so that the baud rate is around 9MBit
      Wish you all the best

    • @benmahmoudramla9121
      @benmahmoudramla9121 4 месяца назад

      hey do you think it essential that i configure the reset of thr rfid even tho that im not gonna use it ?

    • @NizarMohideen
      @NizarMohideen  4 месяца назад

      We have to use the reset pin.

    • @benmahmoudramla9121
      @benmahmoudramla9121 3 месяца назад

      @@NizarMohideen hey i want to know what i need to change in the main code if i want him to read any rfid card not specific ones ?

    • @NizarMohideen
      @NizarMohideen  3 месяца назад

      You can use the same code. It will read all rfid cards

  • @lamiaemaghfoul1238
    @lamiaemaghfoul1238 4 месяца назад +2

    When I click on 'resume,' the values do not change. How can I solve this?

    • @NizarMohideen
      @NizarMohideen  4 месяца назад +3

      In the debugger
      Enable live expressions (Tick)

    • @lamiaemaghfoul1238
      @lamiaemaghfoul1238 4 месяца назад +1

      Yeah, I've already fixed it, but the value still shows as 147 32 0 0. I don't know what the problem is because the values were appearing yesterday, but today, nothing. Even when I change the RFID, it's still the same problem
      @@NizarMohideen

    • @lamiaemaghfoul1238
      @lamiaemaghfoul1238 4 месяца назад +1

      Could I have your email or something similar to send you a screenshot? Maybe you could help me identify the problem. It's really important for my project. Would you be able to do me this favor, please

    • @NizarMohideen
      @NizarMohideen  4 месяца назад +3

      If your project progressed this much far, you are very close to the completion. check the status variable in the live expression and make sure you are getting 0.
      // Success or error code is returned when communication
      #define MI_OK 0
      #define MI_NOTAGERR 1
      #define MI_ERR 2

    • @lamiaemaghfoul1238
      @lamiaemaghfoul1238 4 месяца назад +2

      "I don't understand your response. They still show as 147 32 0 0."
      @@NizarMohideen

  • @jashanrai8190
    @jashanrai8190 3 месяца назад

    Hello sir, I am currently getting "Target Not Available" when on the debug step, any part of the code or circuit I should check?

    • @NizarMohideen
      @NizarMohideen  3 месяца назад +1

      This only works with global variables, i.e. declared outside of main()
      community.st.com/t5/stm32cubeide-mcus/getting-quot-error-target-not-available-quot-in-value-column-in/td-p/170240

    • @jashanrai8190
      @jashanrai8190 3 месяца назад

      @@NizarMohideen Thank you, I got that fixed, however I am getting value of 0 after resume when the pill is touched.

  • @amizitu
    @amizitu 4 месяца назад

    Would you please make a video to connect STM32 with a RFID Wiegand Reader. Or share some resource.
    Thanks.

  • @lamiaemaghfoul1238
    @lamiaemaghfoul1238 4 месяца назад +1

    I am working on a project for an airport with STM32 Nucleo. I have created many systems, each in a separate file, but I don't know how to make them work simultaneously. It is the last step, but I don't know how to do that. Have you already done that in your channel

    • @NizarMohideen
      @NizarMohideen  4 месяца назад +1

      Not yet

    • @lamiaemaghfoul1238
      @lamiaemaghfoul1238 4 месяца назад

      oh okay ,can you do it please i realy need this tutorial@@NizarMohideen

  • @_NguyenQuangTrung
    @_NguyenQuangTrung 3 месяца назад

    why did we need to setting the clock from 8 to 72kHZ ? i dont understand why. Can someone explain for me

    • @NizarMohideen
      @NizarMohideen  3 месяца назад +2

      You can keep 8MHz. It will be fine
      72MHz is better because it is faster
      If you keep at 8MHz, you need to change the prescaler in SPI for the baud rate to be around 9MBit

    • @_NguyenQuangTrung
      @_NguyenQuangTrung 3 месяца назад

      thanks to @@NizarMohideen, I appreciated about this

  • @truongtrongnhan8808
    @truongtrongnhan8808 2 месяца назад

    Hello sir, I have a problem that need your help. The library is great but it i found that the first and the second of str[] is not fixed. My first and second of str[] is 0x70 and 0xB1 (this is the correct code), but sometime it shows 0x93 and 0x20, and then repeat with 0x70 and 0xB1 then repeat 0x93 and 0x20. I saw that your video have met the same error with me. Did you fix that or can you help me fix the bug. Btw, thanks for your tutorial and wish you all the best.

    • @NizarMohideen
      @NizarMohideen  2 месяца назад +1

      Thanks for trying my setups and codes and making it work.
      As for the first two values 0x93 and 0x20, they are showing up even if no cards are present.
      Of course, it is a bug. I am also looking for the fix
      I think we can get away with this for simple projects, avoiding (147) 0x93 and (32) 0x20

  • @hpw5897
    @hpw5897 2 месяца назад

    Hello,I face the problem (status only display 2/sNum display 147 32 0 0) ,may I know u how to fix this problem?
    I use stm32f103vet6 and follow the video coding, but I use mini-rc522,is code not suitable for mini-one?
    The project is stuck here,hope for help

    • @user-seojihye71
      @user-seojihye71 Месяц назад

      I am using the Nucleo F103RB board. I'm having the same problem as you, can you tell me how to fix it?

    • @hpw5897
      @hpw5897 Месяц назад

      @@user-seojihye71i didn’t fix this problem as well,even i change the code and use normal rc522😢
      I think problem is come from board type is not compatible

    • @user-seojihye71
      @user-seojihye71 Месяц назад

      @@hpw5897 I see. Thank you for the information🥲

  • @benmahmoudramla9121
    @benmahmoudramla9121 3 месяца назад

    this is the clock config of my stm32mp157f-k2 what do nu think should i change to make it work ? void SystemClock_Config(void)
    {
    RCC_OscInitTypeDef RCC_OscInitStruct = {0};
    RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
    /** Initializes the RCC Oscillators according to the specified parameters
    * in the RCC_OscInitTypeDef structure.
    */
    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_CSI|RCC_OSCILLATORTYPE_LSI
    |RCC_OSCILLATORTYPE_HSE;
    RCC_OscInitStruct.HSEState = RCC_HSE_ON;
    RCC_OscInitStruct.LSIState = RCC_LSI_ON;
    RCC_OscInitStruct.CSIState = RCC_CSI_ON;
    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
    RCC_OscInitStruct.PLL2.PLLState = RCC_PLL_ON;
    RCC_OscInitStruct.PLL2.PLLSource = RCC_PLL12SOURCE_HSE;
    RCC_OscInitStruct.PLL2.PLLM = 1;
    RCC_OscInitStruct.PLL2.PLLN = 50;
    RCC_OscInitStruct.PLL2.PLLP = 2;
    RCC_OscInitStruct.PLL2.PLLQ = 1;
    RCC_OscInitStruct.PLL2.PLLR = 1;
    RCC_OscInitStruct.PLL2.PLLFRACV = 0;
    RCC_OscInitStruct.PLL2.PLLMODE = RCC_PLL_INTEGER;
    RCC_OscInitStruct.PLL3.PLLState = RCC_PLL_ON;
    RCC_OscInitStruct.PLL3.PLLSource = RCC_PLL3SOURCE_HSE;
    RCC_OscInitStruct.PLL3.PLLM = 1;
    RCC_OscInitStruct.PLL3.PLLN = 61;
    RCC_OscInitStruct.PLL3.PLLP = 27;
    RCC_OscInitStruct.PLL3.PLLQ = 17;
    RCC_OscInitStruct.PLL3.PLLR = 37;
    RCC_OscInitStruct.PLL3.PLLRGE = RCC_PLL3IFRANGE_1;
    RCC_OscInitStruct.PLL3.PLLFRACV = 6660;
    RCC_OscInitStruct.PLL3.PLLMODE = RCC_PLL_FRACTIONAL;
    RCC_OscInitStruct.PLL4.PLLState = RCC_PLL_NONE;
    if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
    {
    Error_Handler();
    }
    /** RCC Clock Config
    */
    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_ACLK
    |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
    |RCC_CLOCKTYPE_PCLK3|RCC_CLOCKTYPE_PCLK4
    |RCC_CLOCKTYPE_PCLK5;
    RCC_ClkInitStruct.AXISSInit.AXI_Clock = RCC_AXISSOURCE_PLL2;
    RCC_ClkInitStruct.AXISSInit.AXI_Div = RCC_AXI_DIV1;
    RCC_ClkInitStruct.MCUInit.MCU_Clock = RCC_MCUSSOURCE_PLL3;
    RCC_ClkInitStruct.MCUInit.MCU_Div = RCC_MCU_DIV1;
    RCC_ClkInitStruct.APB4_Div = RCC_APB4_DIV2;
    RCC_ClkInitStruct.APB5_Div = RCC_APB5_DIV4;
    RCC_ClkInitStruct.APB1_Div = RCC_APB1_DIV2;
    RCC_ClkInitStruct.APB2_Div = RCC_APB2_DIV2;
    RCC_ClkInitStruct.APB3_Div = RCC_APB3_DIV2;

    • @NizarMohideen
      @NizarMohideen  3 месяца назад

      If this code is generated by CubeIDE GUI, keep as it is. No need to change
      But You need to change the SPI Prescalor in GUI and see the the baud rate.
      When the baud rate in is around 9MBit, keep that corresponding Prescalor

    • @benmahmoudramla9121
      @benmahmoudramla9121 3 месяца назад

      @@NizarMohideenwhat are the factors that involves baud rate cause in my case in the mx either i get 6 or 13 as baud rates ( prescalor either 8 or 16) how can i put to 9 ?

    • @NizarMohideen
      @NizarMohideen  3 месяца назад

      Baud rate 6 will be ok

    • @benmahmoudramla9121
      @benmahmoudramla9121 3 месяца назад

      @@NizarMohideen can i email you my project maybe you´ll have an idea about the problem?