Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 26, 2024, 06:07:09 06:07


Login with username, password and session length


Pages: [1]
Print
Author Topic: Using Gameboy to learn ARM embedded programming.. got stuck with RS232!  (Read 4096 times)
0 Members and 1 Guest are viewing this topic.
snoop911
Junior Member
**
Offline Offline

Posts: 44

Thank You
-Given: 27
-Receive: 13


« on: August 05, 2008, 06:35:06 18:35 »

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: http://web.archive.org/web/20060603002957/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 http://darkfader.net/gba/files/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 shorting 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??

Code:
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]);
  }
}

Logged
abd elwahab
Guest
« Reply #1 on: August 16, 2008, 02:59:26 14:59 »

hi all i think this link a goot starting in gameboy advanced programming
http://www.cs.rit.edu/~tjh8300/CowBite/CowBiteSpec.htm
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC