Due USART register access

Hi Folks,

I have decided on a project to emulate a Motorola 6809 microprocessor.

I have created the code to emulate all the instructions and that works pretty well. The next step is interfacing hardware. I've worked out some hardware to emulate the Altair 8800 (just love those switches and blinking LED's) though I have the design complete I'm procrastinating and jumping out to purchase the hardware, but, I will.

My current issue is off board storage of program data. I intend to to save to an iPhone, much like was done with cassette's in the 1970's.
To progress, I need access to the USART's registers with code as I intend to use the synchronous mode with Manchester encoding.

Can someone please offer me some assistance in my endeavors?

Thanks.

The datasheet should help. The index is all the way at the end, and the USART details start on page 789.

Everything you need (USART registers and USART Manchester mode) is available in Sam3x datasheet, USART chapter.

An example sketch to alter Serial1(USART0) and Serial2(USART1):

/********************************************************************************/
/*        Biphase Manchester II format example with USART0 and USART1           */
/*   Hoock a jumper between RX1 and TX2 and onotrher one between TX1 and RX2    */
/********************************************************************************/

#define US_MAN_ONE (0x1u << 29) /**< \brief (US_MAN) Transmitter Manchester Polarity */
char c = 0;
void setup() {

  Serial.begin(250000);

  Serial1.begin(500000); // Serial1 is for USART0
  Serial2.begin(500000); // Serial2 is for USART1

  USART0->US_MR |= US_MR_MAN; 
                  
  USART0->US_MAN = US_MAN_ONE |
                   US_MAN_DRIFT;

  USART1->US_MR |= US_MR_MAN;
                  
  USART1->US_MAN = US_MAN_ONE |
                   US_MAN_DRIFT;

  Serial2.print("Hello");
}


void loop() {
  String s;
  s = "";

  while (Serial1.available() > 0) {
    c = Serial1.read();
    s += c;

  }
  if (s.length() > 0) {
    Serial.println(s);
    Serial2.print(s);
  }
  delay(1000);
}


Thanks for responding Deva, I've spent quite some time in this area of the datasheet that details what to do and that is valuable. However, I want/need a physical example in C++ code on how to achieve those actions.
Thanks again.

Hi ard_newbie, thanks for responding.

Just what I was after, actual C++ code.

I'll give it a try.

Thanks.

I was (also) a little disappointed by the datasheet in that regard. Atmel usually includes those.