The original post can be found at: http://zapmaker.org/arduino/pcduino-runs-arm-a10-with-arduino-ports/enabling-two-additional-serial-ports-on-pcduino/
After some struggling I have been successful in enabling two additional serial ports on my pcDuino. The breakthrough came from JBV’s blog who attempted to enable the additional ports.
In order to do this, here is the high-level approach to take:
- Install 64 bit Ubuntu (I used 12.04 LTS and installed it in a VM on VirtualBox).
- Install cross-compiler for ARM on my 64 bit Ubuntu running on a 64 bit x86 system. DO NOT use the 32 bit Ubuntu because there are tools in the make process that require 64 bit OS. You will have to modify the make file to remove those tools if you use 32 bit.
- Build Linux kernel for pcDuino and verify that the new kernel runs on your pcDuino
- Modify a specific configuration file slightly and rebuild the kernel and deploy to the pcDuino again
- Verify that you can access the two new serial ports
Note – when you enable the serial ports, the SPI0 interface on the pins is no longer available, but I assume this is ok, as there is a SPI2 available.
Here are the steps in detail:
- You should have a running pcDuino. If not, you need to install an OS onto an SD card or onto the NAND depending on which version of pcDuino you are using. The SD Card association has a formatter. Then you can use Win32DiskImager.exe to put the image on the device. For the pcDuino Lite I use pcduino-lite_ubuntu_20130929.img as my image. Once installed, make sure you can boot – then configure everything in the first setup screen (i.e. expand file system, etc. as mentioned in my parent article). I recommend installing the new kernel on a brand new install of your OS if possible (different SD card) so that you don’t accidentally break a working SD card OS. Also, if you are running any significant applications, I strongly recommend setting up a swap file, 512MB should be fine.
- Ensure you have 64 bit Ubuntu installed, i.e. 12.04 LTS is a good choice. Ensure that the system is up-to-date with regard to updates. Optionally install it as a VM on VirtualBox or other Virtualization system like Citrix, VmWare, Hyper-V. You will need 1GB of RAM allocated and about 20 GB of disk space. One CPU is fine. Note that with VirtualBox you must select the Ubuntu 64 bit option, not the regular Ubuntu option in the drop-down. Other Linux flavors may also work.
- You are now logged in Ubuntu with a terminal window open. Follow instructions here to install cross-compiler and build the tar file that you will copy to the pcDuino.
- On that page you will need to get the cross compiler from here. The page appears to have a bunch of cross-compilers that look correct, but there is only one that is correct and that is like they say “arm hf crosscompiler for Linux”. Supposedly you could do this instead, but I don’t recommend it: sudo apt-get install gcc-arm-linux-gnueabihf dpkg-dev
- The build process can take about an hour.
- During make, you may get errors. One thing you may need to do is run sudo apt-get install libusb-1.0-0-dev
- You should have a couple of files in the kernel/output folder when it is done. You need to get the files onto the pcDuino. I recommend copying the files onto a thumb drive or use an FTP server if that is possible (or some other file sharing means available through services on the Internet). Follow the instructions to install, with the last step a reboot. Everything should come up normally after the reboot, including the pcDuino lubuntu user interface.
- Now you will be adding UART 5 and 6. To do this, follow the instructions here. One thing missing from his instructions is that at the point you are editing the fex file, you also need to disable [spi0_para], meaning under that section, set spi_used = 0
- Before you run make, you must first do a make mkproper in folder kernel/linux-sunxi and then move up to the kernel folder and do a make.
- Two brand-new files will appear in the output folder. Copy the tar file and install appropriately.
- After reboot your two serial ports should be available. This can be verified via running sudo dmesg | grep uart
- Finally, you need to test your code. You can use the sample code on JBV’s blog or go to Sparkfun’s C code page on serial interfacing. All their samples can be found here which you can copy via a git clone operation onto the pcDuino within its terminal window. Then you also need to somehow connect the serial output somewhere where it can be monitored. I like to use a serial-to-USB card like this one from Sparkfun. If you use that one you have to break a trace and solder a jumper to switch it from 5v to 3.3v mode. Sparkfun also sells a 3.3v board where you don’t need to do anything. I like the first option as I can reuse it for other 5v projects in the future.
- Wire it up and connect it to your PC’s USB. Then open a program like TeraTerm (Windows) or minicom (Linux) and set the baud rate to match that of the program you compiled – if you have RX-TX connected properly, when you run the program on the pcDuino you should see text appear in your terminal program and vice versa, if you type in the terminal program, the characters should be output to the program running on the pcDuino.
Why all the fuss to get this working? I’m working on a project related to OpenCPN and don’t want to add another board like a netduino or Mega with multiple serial ports.
Leave a Reply
You must be logged in to post a comment.