AnsweredAssumed Answered

CR95H UART

Question asked by JOHN SOLOMON on Apr 9, 2018
Latest reply on Apr 23, 2018 by Peter Boringer

Hi, i am using CR95H RFID CLICK module with raspberry pi3.I am using UART for communication.

I connected,

   SSI_1   =>   GND

   SSI_0   =>   GND

   TX        =>    RX

   RX        =>   TX

   VIN       =>   3.3X

   GND     =>    GND.

 for waking up i am sending 0x00 and then i send echo cmd but i didnt any response.can any one help me out i new to these modules

#include<bcm2835.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/ioctl.h>
#include<stdio.h>
uint8_t buf2[11],buf1;

void send_data(uint8_t buf1)
{
int fd;
fd = open("/dev/ttyS0", O_RDWR, O_NOCTTY);
fd = write(fd, &buf1, 11);
if (fd == -1) {
printf("failed to write the file");

}
usleep(100000);
close(fd);
}

void recv_data()
{
int fd;
fd = open("/dev/ttyS0", O_RDWR, O_NOCTTY);
if (fd == -1) {
printf("failed to open the file");

}
fd = read(fd, buf2, 17);
if(buf2[0]==0x55)
{
printf("ECHO");
}
printf("%x", buf2);
close(fd);

}

int main(void)
{
bcm2835_init();
delay(10);
send_data(0x00);
usleep(10);
for(int i=0;i<10;i++)
{


send_data(0x55);
recv_data();
delay(50);
}

}

Outcomes