Serial Using AVR Names

So I am using an Arduino to communicate with a Linux machine for a project I am working on with friends. I am having issues however writing the serial protocols. We are using AVR register names rather than the Arduino libraries and we do not wish to switch to using the libraries.

I have identified an issue with sending and recieving the serial rather than analysis of what is read. I have included code which should read in a character and transmit it. The issue I am having is that my inputs do not match all my outputs, in fact only the characters h, i, j, k, l, m, and n are read and output correctly.

#include <avr/io.h>

char x;

void setup(void){
  UBRR0H = 0;
  UBRR0L = 103;                      // 9600 Baud
  UCSR0C = (1<<UCSZ00)|(1<<UCSZ01);  // 8 - Bits
  UCSR0B = (1<<TXEN0)|(1<<RXEN0);    // Enable Rx Tx
}

void loop(void){
  x = serialRead();                  // Read in a character
  serialWrite(x);                    // Output that character
}

void serialWrite(unsigned char c){
  while(!(UCSR0A & (1<<UDRE0)));     // Wait until the buffer is clear
  UDR0 = c;                          // Place the character in the buffer
}

char serialRead(void){
  while(!(UCSR0A & (1<<RXC0)));      // Wait for characters to be input
  return UDR0;                       // Read in the buffer
}

Please help. We are running out of time on the project and it just is not coming together.

How are you connecting the Arduino to the computer?

What do you receive when you send, for example, an 'a'?

'a' currently gives me a 'yÉ'

I am using the USB to communicate to the board from Arduino's built in terminal. Before it is asked, yes, the baud rates are being set the same (9600).

'a' currently gives me a 'yÉ'

In hex or binary, please.

How would I go about translating that to binary rather than being converted to ASCII?

I am currently being able to transfer characters from 1 arduino to another to toggle an LED through the Rx and Tx pins. I am now having an issue where I will transmit every 500ms however the other arduino will not recieve the command. I have done some research with regards to latency, and it appears the FTDI chip may be causing issues? Can anyone confirm this can cause issues, and if so, will moving the Atmega to a stand alone product without the chip resolve this issue?

CBrazeau1115: We are using AVR register names rather than the Arduino libraries and we do not wish to switch to using the libraries. ... We are running out of time on the project and it just is not coming together.

Boy those teachers sure are strict! Here, let me do it for you:

void setup(void) { Serial.begin (9600); }

void loop(void)
  {
  if (Serial.available ())
    Serial.write (Serial.read ());
  }

When I tested that, it echoed back the right data. Maybe your Linux box needs work?

I am now having an issue where I will transmit every 500ms however the other arduino will not recieve the command. I have done some research with regards to latency, and it appears the FTDI chip may be causing issues?

Not being able to handle a half-second delay? I don't think so.

Look, this isn't the "do your homework for you" forum. Why don't you want to use the libraries?

Why don't you want to use the libraries?

If the goal is to learn how to do serial communication without the libraries, but the libraries are open source, I fail to see the point.

Even if there is a point, make sending from one Arduino work without the library while receiving uses the library on both Arduinos and sending uses the library on the 2nd Arduino. You've cut the places where bugs might occur by 75%.

When that works, you can have the 2nd Arduino use the non-library method, and you are half-way done. Then, get the first Arduino to receive without the library. When that works, use the same code on the other Arduino, and you are done.

Pointless, to me.