This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using Gameboy to learn ARM embedded programming.. got stuck with RS232!

I recently picked up a GBA, along with an ez flash cartridge, just to have an inexpensive platform to fiddle with an ARM!

After flashing some simple Hello World apps, to make sure my toolchain / programmer is working properly, I flashed a uart program found here: web.archive.org/.../http://www.fivemouse.com/gba/ . The application is supposed to echo any serial data received.

For the GBA/UART Cable, I would have preferred to buy one ready made, but couldn't find one in stock (ex. "GBA UART" over at http://one-stop-china.com/ )... so I bought a gba multilink cable cut off one end and wired it up according to darkfader.net/.../UART.gif . Pin 1 is 3.3v, but the level shifter requires 5v, so I left the GBA's pin 1 unconnected.

Unfortunately, I can only get data *TO*the GBA, I see no activity coming *OUT* of it! The ascii text I send out of the PC Hyperterminal displays exactly on the GBA screen, but there's no activity going the other way (on the TX line on the GBA connector end)!

I've tried shouting to the CTS and RTS lines so that the GBA can send without hardware handshaking, but no luck. Not sure what it could be, I even thought it could be the GBA (since I bought it used), so I picked up another one on ebay and that has the same issue!!

Anyone ideas what could be the issue??

void InitUART(unsigned short UART)
{
  // The user should only be choosing the speed
  // Stick a character in the data register. This stops the GBA transmitting a
  // Character as soon as it goes into UART mode (?!?)
  REG_SIODATA8 = 'A';

  // Now to go into UART mode
  REG_RCNT = 0;
  REG_SIOCNT = 0;
  REG_SIOCNT = UART | SIO_CTS | SIO_LENGTH_8 | SIO_SEND_ENABLE
             | SIO_RECV_ENABLE | SIO_USE_UART;
}


void sndChar(unsigned char Character)
{
  // Wait until we have a CTS signal
  while(REG_RCNT & 0x0010);
  // Bung our byte into the data register
  REG_SIODATA8 = Character;
}

void AgbMain(void)
{
  unsigned char InChar[2];

  // Set to UART mode
  InitUART(SIO_BAUD_115200);

  // Just keep on looping...
  while(1) {
    // Read in a character
    InChar[0] = rcvChar();
    InChar[1] = 0;

    // If it's a CR, shift up the screen
    if(InChar[0] == 13) {
      ShiftScreen();
      ResetCursor();
    } else {
      // Otherwise, display it on teh screen
      Print(InChar);
    }

    // Echo it back as well
    sndChar(InChar[0]);
  }
}

0