wtorek, 29 października 2013

ADS1278EVM-PDK in Linux

Please take into account that I do not take any responsibility for any damage caused through use of presented solution.

As TI does not support Linux for its evaluation module here is presented simple solution to trigger data acquisition from Linux command line.

First step in order to run under Linux firmware has to be loaded into MMB0 board.
Firmware exists in "ads1278.bin" file somewhere in "ProgramFiles\ADSPro\...".
According to documentation parameters necessary to communicate with MMB0 via USB are following:
VENDOR_ID = 0x0451
PRODUCT_ID = 0x9001
ENDPOINT_ADDR = 0x06
Endpoint is bulk type waiting for data from PC.
Here is simple app to load firmware from userspace.
Application uses libusb-1.0 library therefore can be build with e.g.:

g++ -I /usr/include/libusb-1.0/ -l usb-1.0 usbfirmwareload.cpp -o usbfirmwareload


To load firmware just run "usbfirmwareload" from folder where "ads1278.bin" is stored (to do that perhaps you should be root).

After firmware is successfully uploaded led segment shall show letter "S" (BTW it looks quite strange).

Next step is to perform communication with loaded software.
First thing to spot is change in USB configuration, now we have:
VENDOR_ID = 0x0451
PRODUCT_ID = 0x5718
and two endpoints have appeared - for both data directions:
0x01 - output endpoint,
0x81 - input endpoint.

Communication protocol is build upon "cstyx" library which provides bunch of function that realizes communication as virtual filesystem. Library can be downloaded using SVN:
svn checkout svn://svn.berlios.de/cstyx
In following location archive with minimal version of the library necessary for communication is prepared. It also contains simple and dirty makefile to build the library.

With prepared library it is possible to send requests to MMB0 and receive data. Application to perform arbitrary operation in cstyx virtual filesystem is also available in archive file - please use makefile from "app" folder (after library is built in "cstyxminlib" folder).
Note that cstyx uses libusb and not libusb-1.0 library for USB communication therefore libusb is also required to be available in system.

With "adscomm" application it is easy to invoke operations on MMB0, e.g. to change digit in led segment to "8" following command can be used:
./adscomm -p "/mmb0/led/ch" -w 8
allowed params are:
  • -p XXX - use path XXX in cstyx virtual filessytem,
  • -w YYY- write YYY to file XXX specified with -p,
  • -r - read from file XXX specified with -p,
  • -f ZZZ - read from file XXX specified with -p and stored values in file ZZZ.
Command can be chained to perform multiple actions one after another, e.g.:
./adscomm -p "/version" -r -p "/mmb0/led/ch" -w 1
prints version read from MMB0 and changes led digit to 1.

In "app" directory simple scripts are available:
  • initcomm - performs default initialization (tries to mimic ADCPro initialization for ADS1278EVM),
  • inithighres - initializes ADS1278EVM for high-resolution acquisiton,
  • record - reads 10000 samples from all channels and stores data in "data" file (in current directory).
After measurement is finished it would be nice to see the values - it can be done with last file "plotdata".
The file contains description to parse binary file content for gnuplot application.
After following command invoked:
gnuplot -p plotdata
one can see the results:


Brak komentarzy:

Prześlij komentarz