Empty

Total: $0.00

PSoCXPIM1 - Detailed instructions for Windows

Microsoft Windows 7

A web based interface to a USB connected PSoCXPIM1 board.

This is a guide to programming the PSoCXPIM1 board with our firmware and installing the host software on a PC. The example offers a web based UI that can get and set digital I/O pins on a PSoCXPIM1 board. The application code is written in JavaScript in the Node.js environment.

We aim to demonstrate the various technologies. We are not presenting this as a deployable system. The intent is to demonstrate the technologies in a simple example. You may use these technologies to meet your needs. There are many others.

Specific versions of the various components are specified. They were used in April 2013 and worked together. As these evolve there may be changes that require modification to these guidelines.

See the diagram of the various software components.

  1. PSoC Firmware
    A PSoC Creator project is available at http://code.google.com/p/powerfulboard It is included in the zip file accessed from the “Download” menu. You can also select the “Software” item from the menu and then browse the source or clone the GIT repository. Find it in the firmware in the “pinout” directory.
    Download the project and open it in PSoC Creator. We used PSoC Creator 2.2.
    This is the TopDesign.cysch file:

    Rather simple but this was the objective.

    Connect your PSoCXPIM1 board to your PC. Use the USB connector closest to the FX2 chip.
    Then “program” the PSoC chip through the FX2 part.
    You can also “Debug” the code. You can set breakpoints. We insert “antrace(uint8)” statements at interesting points in the code. Then either when execution stops at breakpoint or by choosing “Halt Execution” we can examine the contents of “tracebuf[]”.

  2. USB driver
    We use an open source USB driver. This has an associated library which we link with the native code on the PC.
    It is available here http://libusb-win32.sourceforge.net
    We used version 1.2.6.0.
    “Libusb-win32 is a library that allows userspace application to access USB devices on Windows operation systems (Win2k, WinXP, Vista, Win7).”
    Install the driver on your PC. Use “inf-wizard.exe” to associate the driver with the PSoCXPIM1 board. Make sure the cable is plugged into the USB connector nearest the PSoC chip. This is NOT the one you used to do the programming.

  3. Node.js
    Download Node.js from http://nodejs.org/ and install.
    We need to interface the JavaScript code to the native library. To do this install the “ffi” (foreign function interface) module.
    First install Python. We used Python version 2.7.4
    npm install -g -node-gyp
    npm install ffi

    For some reason we had to comment out “import multiprocessing”. We hope someone can explain why.

  4. JavaScript Application
    This is included in the code you downloaded from the Google Project in Step 1. It’s in the host/anpso3pins directory. Place it in a directory of your choice on your PC.

  5. Native library
    This native library includes the libusb-win32 library and higher level functions to find the PSoCXPIM1 board and then send and receive messages to the PSoC firmware loaded in Step (1). You can download it here.
    Place it in the same directory as the JavaScript application code in Step 4.

  6. Execution
    Plug a USB cable into the USB connector nearest the PSoC chip.
    Note: you can have usb cables plugged into both USB connectors at the same time. One is used for programming/debugging the other for the host application to communicate with the firmware.

    In a Windows command window move to the directory with the application code.
    Then execute the command
    node index.js
    Open a web browser
    http://localhost:8888

    You should see the following:

    You can now set and get the status of the pins on the board.
    You can also access the webserver from a remote PC.

We hope this worked for you. If you got stuck in the weeds then send us an email and we will try and get you back on the trail.