#32429 - ghostils - Wed Dec 22, 2004 8:22 pm
Ok I found a nice thread on the xboo protocol after I had spent about 2 hours messing around and figuring out that I needed to recieve bits on the ACK line of the LPT port. Which is now working, however there is such a sync problem lol. I figured that would happen, but what I wanna know is how is the GBA Uart sending data?
lemme post the GBA Serial Start up code I have:
I had found this on another thread post about the serial port. Now I can see the baud rate, and it looks like its sending in 8bit mode, however I didn't see Parity or Stop bits (which is going to be important if its using RS232, which I think it does.... but who knows) (this is what I"m trying to find out from you guys how this thing sends data, and the best way to interface to the pc)
Anyway, here is my code for the pc side of things, its pretty simplistic too:
I read the status register (where the ACK bit) is located which is what the GBA Xboo Serial Send pin is connected to: a bit at a time is recieved, ACK goes high I print a 1, ACK goes low I print a 0, I format it for 8 bits per line. With a 30ms delay.
So I guess the question is how do I reliably get these two to talk and transfer data that is meaningful?
Or is there a better way? And mebbe some code examples please =)
Thanks,
-ghost[iLs]
lemme post the GBA Serial Start up code I have:
Code: |
unsigned char byte = 'A'; REG_SIODATA8 = byte; REG_RCNT = 0; REG_SIOCNT = 0; REG_SIOCNT = SIO_BAUD_9600 | SIO_LENGTH_8 | SIO_USE_UART | SIO_CTS; REG_SIOCNT |= SIO_SEND_ENABLE | SIO_RECV_ENABLE; //-Just keep sending A's while(1) {REG_SIODATA8 = byte;} |
I had found this on another thread post about the serial port. Now I can see the baud rate, and it looks like its sending in 8bit mode, however I didn't see Parity or Stop bits (which is going to be important if its using RS232, which I think it does.... but who knows) (this is what I"m trying to find out from you guys how this thing sends data, and the best way to interface to the pc)
Anyway, here is my code for the pc side of things, its pretty simplistic too:
I read the status register (where the ACK bit) is located which is what the GBA Xboo Serial Send pin is connected to: a bit at a time is recieved, ACK goes high I print a 1, ACK goes low I print a 0, I format it for 8 bits per line. With a 30ms delay.
Code: |
#include <sys/io.h> #include <unistd.h> #include <stdio.h> #define BASE_ADDR 0x378 #define REGDATA BASE_ADDR + 0 #define REGSTATUS BASE_ADDR + 1 #define REGCONTROL BASE_ADDR + 2 int main(void) { int status = 0; int bit = 0; unsigned char byte = 128; //-Turn on direct LPT port access from data to control registers: status = ioperm(BASE_ADDR, 3 ,1); if(status) { printf("Error: ioperm::enable\r\n"); return -1; } while(1) { //-Read from Status Register: byte = inb(REGSTATUS); //-ACK = Bit 6: HIGH = 1 LOW = 0 //-Format output in bytes: if(byte == 120) {printf("1");} else if(byte == 56) {printf("0");} if(bit++ >= 7) {printf("\r\n"); bit=0;} //-Sleep 30ms: usleep(30000); } //-Turn off LPT port access fr status = ioperm(BASE_ADDR, 3 ,0); if(status) { printf("Error: ioperm::disable\r\n"); return -1; } return 0; } |
So I guess the question is how do I reliably get these two to talk and transfer data that is meaningful?
Or is there a better way? And mebbe some code examples please =)
Thanks,
-ghost[iLs]