Jump to content

A Simple USB to TTL Convertor

Recommended Posts

I recently purchased a Cubietruck/Cubieboard3 (http://cubieboard.org/2013/10/30/cubieboard3-cubietruck-is-all-ready/and since I want to customize the kernels, I needed a USB to TTL Serial converter at 115200bps. Being a weekend I was too lazy to go out to the electronics hardware market, and since I wanted it immediately I did not want to buy it online. So I felt I should be able to use one of my Stellaris Launchpad boards for this purpose. Here is the code for USB to TTL Serial conversion. A better option would be to code directly in "C" with the USB library in Tivaware/Stellarisware, but this code is so simple that I would not waste my time doing it right now. The code should work with any hardware supported by the Wiring framework. 


 -----Code starts here----------

//Red-Blue Combination is most visible for data status indication
const int read_LED = RED_LED; //Red LED blinks on data read
const int write_LED = BLUE_LED; //Blue LED blinks on data write

int read_State=LOW, write_State=LOW;

void setup()
  pinMode(read_LED, OUTPUT); 
  pinMode(write_LED, OUTPUT);
  Serial1.setPins(UART1_PORTB); //Comment if you need to use the alternate port PC4/PC5
  Serial.println("Simple USB TTL Converter - Stellaris/Tiva Launchpad");

void loop()
  if (Serial.available()){

  if (Serial1.available()){


------Code Ends here -------

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...