We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I want to send command an array of hexadecimal values together to my device pn544 through uart1. Basically,save the command in TX FIFO and transmit the bytes together here is part of my code.
void init_serial1 (void) { PINSEL0 = 0x00050000; U1LCR = 0x83; U1DLL = 97; U1LCR = 0x03; U1IER = 0x00; U1FCR = 0x01; //Enables and Resets FIFO, 2 byte //U1FCR = 0x41 /* set up the interrupts */ VICVectAddr1 = (unsigned long) u1_interrupt; VICVectCntl1 = 0x20 | 7; VICIntEnable = 0x00000080; U1IER = 0x03; sendcmd(); } // sending command to pn544 void sendcmd(){ int cmd[2]= 0; int i =0; cmd[i]= 0x84; cmd[i+1]= 0x00; for(i = 0;i < 2;i++) { sendchar(cmd[i]); } } int sendchar (int ch) { while (!(U1LSR & 0x20)); return (U1THR = ch); } void __irq u1_interrupt(void) { char intrpt =0x00; char dummy = 0x00; volatile char stat; stat = U1IIR & 0x0F; while (stat != 1) { switch (stat) { case 0x06: dummy = U1LSR; break; case 0x04: case 0x0C: intrpt = U1IIR; U1IIR |= 0x01; intrpt = U1RBR; putchar_uart0(intrpt); break; case 0x02: /* THRE Interrupt */ intrpt = U1IIR; U1IIR |= 0x01; /* Clear Interrupt */ IODIR1 = 0x00FF0000; IOSET1 = 0x000F0000; break; case 0x00: /* Modem Interrupt */ dummy = U1MSR; break; default: break; } stat = U1IIR & 0x0F; } VICVectAddr = 0x01; /* acknowledge interrupt */ } /pre> Now my question is: 1)how should i send my command-0x84 0x00 together to the pn544.like put the bytes in the fifo and hen send them instead of sending one byte at a time. 2)How do we put characters in transmitter fifo? 3)I have set U1FCR to 1 character trigger level as U1FCR = 0x01; This has to do with receiver fifo and not transmitter fifo.. right? Any suggestions are appreciated. thanks
hi i want to ask if finished your code and show me your example thanks in advance