EMBEDDED PROJECTS JOURNAL
100% frei und kostenlos,
als PDF und in gedruckter Form,
per Open Source Lizenz
AVR-RISC (Infos)
Embedded Software selbst entwickeln
(inkl. Absatz über USBprog)
AVR-Starterkit für 61,90 EUR
Quicklinks: Home | Online Firmware Pool | Shop
     

OctopusUSB Interface Converter and I/O Extension for Computers

Contact: Benedikt Sauter, sauter@ixbat.de 

 

What's OctopusUSB?

 
 Prototyp des OctopusUSB (lieferbar ab mitte Novemvber)

OctopusUSB offers many different Interfaces from the world of microcontroller over an easy USB interface. So you can use IO-Ports, AD Converters, I2C, RS232, SPI, CAN (opt.) easy in your own pc application. The functions can be called in different languages (C, C++, Java, Python, ...).
 

Because the software is a completely open source, and the components for the device simple and cheap to get, OctopusUSB is the ideal companions for tests, handiwork or as a tool for development.

 
All schematics and sources prospective from the firmware to the libraries and the drivers are published as open source.

Online Shop: OctopusUSB can be bought as preassembled kit in the Embedded Projects Shop.

 

Features:

  • 2   x UART (RS232 Converter, only RX and TX)
  • 1   x I2C Bus (Master)
  • 1   x SPI Interfaqce
  • 2   x PWM Signals
  • 8   x Analog Digital Converter
  • 38 x Digitale I/O Ports



How can I work with OctopusUSB?

You can connect you to OcotpusUSB in GNU/Linux, Windows or MacOS(x) with the Octopus library which is offered for C,  C++, Java, Python, etc. Also there are growing a driver kernel modul, with that you can control the interfaces of Octopus as real devices of a GNU/Linux. So you can use the UARTs as /dev/ttyUSBx, the I2C Interface as /dev/i2c and so on.

A further method is hopefully the finished soon openXIO Lab. openXIO Lab is a "electronic labotary" for the pc. Over a grafical user interface it is possible to control all functions of Octopus.

 

 

Installing OctopusUSB

The Octopus is currently still not programmed when it is committed. So you have the following for the Inbetrienahme done:

  1. Download the latest firmware: http://octopususb.googlecode.com/svn/trunk/firmware/main.hex
  2. With an AVR programming firmware on the Octopus transferred (Attention - is the default ATMega128 with only 1 MHz, which means the speed at the ISP min. KHz 250 (within 1 / 4 of the CPU speed) to be throttled.
  3. Setting fusebits (with avrdude: lfuse 0xe0, hfuse = 0xdd and efuse 0xff)
  4. After the infected should be stored in the seven LEDs on Octopus flashing a brief sequence can be played.

Driver installation

In order to be able to use Octopus, a driver is required. For Windows, there is a driver package for downloading on downloads. In Linux and & Co., however, it is only the rich libusb unique to install. Depending on the desired target language can be an example from the source archive, including the description as a starting position can be used. The source archive is on the navigation downloads reach.
 

Support

For questions, problems or other logs you on the idea at our best forum for Octopus. This can be found here: http://forum.embedded-projects.net/viewforum.php?id=14
   

Downloads 


API

 

/***************************************************************************
                          octopus.h  -  description
                             -------------------
    begin                : Fri Oct 25 2007
    email                : sauter@ixbat.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Lesser General Public License           *
 *   version 2.1 as published by the Free Software Foundation;             *
 *                                                                         *
 ***************************************************************************/

#ifndef __liboctopus_h__
#define __liboctopus_h__

#include <usb.h>


#define VID 0x1781
#define PID 0x0c65

/**
  \brief Main context structure for all liboctopus functions.

 Do not access directly if possible.
*/
struct octopus_context {
    // USB specific
    /// libusb's usb_dev_handle
    struct usb_dev_handle *usb_handle;

    /// String representation of last error
    char *error_str;
};

/**
    \brief list of usb devices created by octopus_usb_find_all()
*/
struct octopus_device_list {
    /// pointer to next entry
    struct octopus_device_list *next;
    /// pointer to libusb's usb_device
    struct usb_device *dev;
};

#ifdef __cplusplus
extern "C" {
#endif

  int octopus_init(struct octopus_context *octopus);
 
  int octopus_open(struct octopus_context *octopus);
  int octopus_open_id(struct octopus_context *octopus, int vendor, int product);
  int octopus_open_serial(struct octopus_context *octopus, char * serial);

  int octopus_open_dev(struct octopus_context *octopus, struct usb_device *dev);
 
  int octopus_close(struct octopus_context *octopus);
  int octopus_reset(struct octopus_context *octopus);

  int octopus_status(struct octopus_context *octopus);
  int octopus_logging(struct octopus_context *octopus);
 
  char * octopus_get_hwdesc(struct octopus_context *octopus, char *desc);

  /// part: IO
 
  int octopus_io_init(struct octopus_context *octopus, int pin);
  int octopus_io_init_port(struct octopus_context *octopus, int port);
 
  int octopus_io_set_port_direction_out(struct octopus_context *octopus, int port,unsigned char mask);
  int octopus_io_set_port_direction_in(struct octopus_context *octopus, int port, unsigned char mask);
  int octopus_io_set_port_direction_tri(struct octopus_context *octopus, int port, unsigned char mask);

  int octopus_io_set_pin_direction_out(struct octopus_context *octopus, int pin);
  int octopus_io_set_pin_direction_in(struct octopus_context *octopus, int pin);
  int octopus_io_set_pin_direction_in_pullup(struct octopus_context *octopus, int pin);
  int octopus_io_set_pin_direction_tri(struct octopus_context *octopus, int pin);

  unsigned char octopus_io_get_port(struct octopus_context *octopus, int port);
 
  int octopus_io_set_port(struct octopus_context *octopus, int port, unsigned char value);
 
  int octopus_io_set_pin(struct octopus_context *octopus, int pin, int value);    //buffered

  int octopus_io_get_pin(struct octopus_context *octopus, int pin);

  /// part: adc
 
  int octopus_adc_init(struct octopus_context *octopus, int pin);
  int octopus_adc_get(struct octopus_context *octopus, int pin);
  int octopus_adc_ref(struct octopus_context *octopus, int ref);
  // 1= extern AREF, 2 = AVCC as reference, 3=intern voltage


  /// part: I2C
  int octopus_i2c_init(struct octopus_context *octopus);
  int octopus_i2c_deinit(struct octopus_context *octopus);
  
  int octopus_i2c_speed(struct octopus_context *octopus, int speed);
 
  int octopus_i2c_start(struct octopus_context *octopus);
  int octopus_i2c_stop(struct octopus_context *octopus);
  int octopus_i2c_restart(struct octopus_context *octopus);

  int octopus_i2c_slave_address(struct octopus_context *octopus, unsigned char address);

  int octopus_i2c_send(struct octopus_context *octopus, unsigned char * data, int length);
  unsigned char octopus_i2c_recv(struct octopus_context *octopus, int length);
 
  int octopus_i2c_recv_ack(struct octopus_context *octopus);
  int octopus_i2c_send_ack(struct octopus_context *octopus);
  int octopus_i2c_send_nack(struct octopus_context *octopus);
 
  /// part: UART
  int octopus_uart_init(struct octopus_context *octopus, int uartport);
  int octopus_uart_deinit(struct octopus_context *octopus, int uartport);

  int octopus_uart_default(struct octopus_context *octopus, int uartport); //9600 8N1
  int octopus_uart_speed(struct octopus_context *octopus, int uartport, int speed);
  int octopus_uart_stopbits(struct octopus_context *octopus, int uartport, int stopbits);
  int octopus_uart_databits(struct octopus_context *octopus, int uartport, int databits);
  int octopus_uart_parity(struct octopus_context *octopus, int uartport, int parity);

  int octopus_uart_send(struct octopus_context *octopus, int uartport, unsigned char * buf, int length);
  int octopus_uart_recv(struct octopus_context *octopus, int uartport, unsigned char * buf, int length);

  /// part: SPI
  int octopus_spi_init(struct octopus_context *octopus);
  int octopus_spi_deinit(struct octopus_context *octopus);
 
  int octopus_spi_speed(struct octopus_context *octopus, int speed);
  int octopus_spi_send(struct octopus_context *octopus, unsigned char * buf, int length);
  int octopus_spi_recv(struct octopus_context *octopus, unsigned char * buf, int length);
  int octopus_spi_send_and_recv(struct octopus_context *octopus, unsigned char * buf, int length);


#ifdef __cplusplus
}
#endif

#endif /* __liboctopus_h__ */
 

 

 

 © 2007 by Embedded Projects, Benedikt Sauter