GT-511C3 Fingerprint Scanner with STM32F407G Microcontroller

0

I am working on a project that requires using the GT-511C3 fingerprint scanner with a STM32F407G microcontroller board. I am using Keil uvision 5 and can't figure out how to initialize and turn on the scanner. I've written this code and it seems correct, based off the datasheet, for starting up the scanner and sending the start commands. I've used an oscilloscope to verify that the values are being sent correctly and it seems they are but the scanner is not lighting up. I'm completely lost on what I could be doing wrong or what I could be missing. I've verified the scanner is wired correctly and connected to the board accordingly. Any help would be gr8 :)

Scanner: https://www.digikey.com/catalog/en/partgroup/fingerprint-scanner-ttl-gt-511c3/56722

Current Code:

#include "stm32f4xx.h"                  // Device header

int i=0;
int z=0;

int main(){

// ENABLE CLocks for PORT C and UART4
RCC -> AHB1ENR = 0x00000004; //Enable the clock to GPIO port GPIOCEN
RCC -> APB1ENR = 0x00080000; //Enable the clock to UART 4 UART4EN



// Set Mode Pins on Port C pins 10 and 11 to Alternate Function
GPIOC->MODER|=0x00A00000;


// Set Alternate Function Register for Port C 10 and 11
GPIOC->AFR[1]|= 0x00008800; //AFR High = enabled


// UART setup:
// 8 data bits (default), no parity (default), one stop bit (default) & no  flow control (default)

// UART Baud Rate
UART4->BRR = 0x683;

// Enable  TRANSMITTER (TE bit)
UART4->CR1 |= (1<<3);
UART4->CR1 |= (1<<2);

// WE WANT TO TRANSMIT SO ENABLE TRANSMIT INTERRUPT
UART4->CR1 |=(1<<7);


// Enable UART  (UE bit in CR1 register) 
UART4->CR1 |=(1<<13);


// NVIC to handle interrupts

__enable_irq();
NVIC_ClearPendingIRQ(UART4_IRQn);
NVIC_SetPriority(UART4_IRQn,0); 
NVIC_EnableIRQ(UART4_IRQn);

while(1){};

}

// Interrupt reoutine for UART1

void UART4_IRQHandler(void){
// TX IRQ 
if(((UART4->SR)&(1<<7))>0){ //if txe flag in sr is on then
    if(z==0){
    int command[]={0x55,0xAA, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x01};
    UART4->DR=command[i]; // command start code
    i=i+1;
    if(i==12){
        z=1;
        i=0;
    }
}
    if(z==1){
    int command1[]={0x55,0xAA, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x12, 0x00, 0x13, 0x01};
    UART4->DR=command1[i]; // command start code
    i=i+1;
    if(i==12){
        z=0;
        i=0;
    }
}
}
}
c
microcontroller
keil
asked on Stack Overflow May 10, 2017 by Mark Buns • edited Aug 3, 2019 by glts

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0