Thursday, July 5, 2012

using urjtag to program a Xlilinx xc2c64a cpld

Get and install urjtag.
Get the bsdl description for the Xilinx cpld  you are using in my case it was the xc2c64a_qf48.bsdl.  It's also available as part of the Xilinx ISE as
/opt/Xilinx/13.4/ISE_DS/ISE/xbr/data/xc2c64a_qf48.bsd.  You'll have to have the ise webpack installed to generate the svf programming file so it doesn't really matter where you get the file from.
Next you need a generate an .svf to program the device.  This is generated with xilinix Impact (part of the Xilinx ISE).  A good tutorial is always helpful.  The just of it though is that you record a script by running the Impact Gui in a special mode.  I named my .svf file program.svf

After that things get pretty simple
Connect cpld to programming cable

then do the following which I'll end up pushing into a script.  The bad part of all this though is that you have to regenerate the .svf file any time you make a change to the cpld.

[crowe@localhost i2cslave_rx]$ jtag

UrJTAG 0.10 #2026
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors

UrJTAG is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for UrJTAG.

warning: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.

jtag> cable gnice+
Connected to libftd2xx driver.
jtag> bsdl path /home/crowe/mc/lp-anemometer/i2cslave_rx
jtag> detect
IR length: 8
Chain length: 1
Device Id: 00000110111001011001000010010011 (0x06E59093)
<<  Filename:     /home/crowe/mc/lp-anemometer/i2cslave_rx/XC2C64A_QF48.bsdl
jtag> svf program.svf
jtag> quit




Wednesday, May 9, 2012

Android Bluetooth App Development Test Fixture

The standard android app development environment as of May 2012 doesn't appear to allow Bluetooth.  It appears that you have to use a virtual environment.  I chose Oracle VM VirtualBox as my test bed.  Below are my notes on getting this to work.

Basic Virtual Box Setup

Download the eeepc version of Android from Google following this guys instructions.

Here is the summary of the Oracle Virtual Box Settings I used:

General

  • Name: "name for this instance"
  • Operating system: Linux
  • Version: Other Linux

Storage

  • Add eeepc.iso image as cd rom device

Network

  • Attached to: Bridged Adapter
  • Name: etho
  • Adapter Type PCnet-FASTIII (AM79C973)

USB

  • Check Enable USB Controler

Allowing USB devices requires that you add your user account to "vboxusers" as root with usermod -a -G vboxusers username then log out and back in again!


Start the virtual box and let Android boot.

Brining up Networking 

Ronubo has a good guide, here is the summary
Bring up a terminal prompt in Android (there's one there somewhere).
Bring up the interface with:
  • netcfg eth0 dhcp  # brings up eth0 and gets dhcp address
  • route  add default gw xxx.xxx.xxx.xxx dev eth0 
  • setprop net.dns1  10.1.1.13  # Nubo DNS1
  • setprop net.dns2  10.1.1.12 # Nubo DNS2
  • setprop net.dns3  8.8.4.4 # Google DNS
I only used one DNS server (Google) and that seemed to work
If you've completed the above you should be able to browse the net

Here's a hint alt+F1 and alt+F7 toggle terminal window/ gui


If Android goes to sleep its hard to wake up.  From Virtual box send the shutdown signal, then use the mouse to unlock the device (wierd)

Unfortunately none of this can be saved if you stop the machine,  I suggest taking a snapshot at some point and use that (untested).

Setting up ADB Connection 

On the Linux host – connect to ADB as follows:
On this example, our Android IP address is 192.168.1.109/2 , ADB server runs on port 5555 (by default), so in order to connect to the target via adb we do this on the Linux host:

adb connect 192.168.1.109:5555

After that the Eclipse environment should be able to download and debug using the Virtual box environment.

Getting the USB Bluetooth to work

I had some difficulty getting Bluetooth to work.  It ended up that it was a little touchy about which USB-Bluetooth device it would work with.  I ended up with a Zonet device.  I was able to pair with a bluetooth serial device after turning on the Bluetooth from within Android.

Tuesday, May 8, 2012

Settling on Arm Cortex M3  atmel ATSAM3S4B  It's a USB device in a 64 pin qfn package (small) that has a high speed uSD (MCI) interface.  I've ordered an eval board

Friday, May 4, 2012

Giving up on ARM 7 microprocessors.  Moving to Arm Cortex-3 series.  The biggest obstacle to implementation of the ARM7 for my application was the need for an external clock source (xtal or osc).  My application is a low power data logger for recording shock events.  The existing product has had failures with the xtals.

Good link though on ARM Sam 7

Thursday, May 3, 2012

Notes on bringing up Olimex SAM7Pxxx eval board for Atmel AT91SAM7xxx microprocessor.

Toolchain Installation

I installed the arm cross compiler using crosstool I used the preconfigured /usr/local/lib/ct-ng-1.13.4/samples/arm-unknown-eabi to make the toolchain.  Tool chain was automatically downloaded, compiled and installed in ~/x-tools

Download Tools

Download the the SAM-BA linux gui tool from Atmel. After downloading the tool,  unzip it and run the executable. 

Enabling the download Code

There is a header labeled test.  Connect this header an apply power for 10 sec (I tried less than 10 sec and it didn't work, but I might have been having other problems)  See the Olimex Instructions for details

Programming  the internal FLASH
Figure 1: sam-ba gui connected to Olimex SAM7-Pxxx Board

  1. After connecting the board with USB, /dev/ttyACM0 should show up in the dev list.
  2. Start SAM-BA and select board type "at91sam7s256-ek".  As far as I can tell,  EPROM AT24 doesn't exist.  
  3. Change the start address in the Memory Display area to 0x100000 to set it to Flash.
  4. Select the Flash tab and execute the script to "Erase all Flash".  
  5. After it erases, refresh the memory display.  
  6. Verify that the flash has been erased (all 1's).  
  7. Select a file to send to the flash.  I used the blinky demo.  There is a .bin file in the package ready to be sent. 
  8. After sending the file, hit the refresh in the memory display to verify that the flash programmed.
  9. Quit the SAM-BA.  If you use disconnect it won't reconnect properly and the app has to be restarted anyway.
  10. Reboot the board.  Your code should start executing.  In my case the Led's blink.