FlexSEA https://OFFLINEZIP.wpsho Wearable Robotics Tookit Mon, 06 Jun 2016 14:39:08 +0000 en-US hourly 1 https://wordpress.org/?v=5.8 Debugging FlexSEA-Execute with the MiniProg3 http://OFFLINEZIP.wpsho2016/06/06/debugging-flexsea-execute-with-the-miniprog3/?utm_source=rss&utm_medium=rss&utm_campaign=debugging-flexsea-execute-with-the-miniprog3 Mon, 06 Jun 2016 14:39:08 +0000 http://OFFLINEZIP.wpsho?p=327 Read Now]]> In Programming FlexSEA-Execute 0.x we went over using the MiniProg3 to program Execute. With the same tool, the MiniProg, you can also debug your program. As a starting point, please look at the CY8CKIT-002 PSoC® MiniProg3 Program and Debug Kit page. Check the references, especially ‘Miniprog3 User Guide.pdf’ that covers all the basics in a few pages. The PSoC® Creator Tutorial – Introducing the Debugger video gives a great overview of the tool in only one and a half minute.
When using the GUI and USB, I prefer to program the board (and by that I mean Release mode, not debug mode), launch the GUI, and then use Attach to Running Target and click Play/Run. That way I can make sure that the debugger won’t prevent proper USB enumeration.

Understanding main.h (Execute) http://OFFLINEZIP.wpsho2016/06/06/understanding-main-h/?utm_source=rss&utm_medium=rss&utm_campaign=understanding-main-h Mon, 06 Jun 2016 14:01:48 +0000 http://OFFLINEZIP.wpsho?p=311 Read Now]]> //Valid communication from USB? if(cmd_ready_usb != 0) { cmd_ready_usb = 0; //Cheap trick to get first line //ToDo: support more than 1 for(i = 0; i < PAYLOAD_BUF_LEN; i++) { tmp_rx_command_usb[i] = rx_command_usb[0][i]; } //payload_parse_str() calls the functions (if valid) result = payload_parse_str(tmp_rx_command_usb); //LED: if(result == PARSE_SUCCESSFUL) { //Green LED only if the ID matched and the command was known new_cmd_led = 1; } } ]]> Debugging: broken circuit and/or sensor? http://OFFLINEZIP.wpsho2016/06/06/debugging-broken-circuit-andor-sensor/?utm_source=rss&utm_medium=rss&utm_campaign=debugging-broken-circuit-andor-sensor Mon, 06 Jun 2016 13:59:43 +0000 http://OFFLINEZIP.wpsho?p=308 Read Now]]> Your prosthetic joint was up and running, you were playing with control gains… and then something broke. How can you easily figure out what’s wrong? The steps below are based on FlexSEA-Execute, but the general principles can be applied to any circuit. Most problems are linked to external sensors (broken cable, loose crimp, etc.) or to power: this tutorial will focus on that. Start with Step 1) and move up the list when the tests are successful.

  1. Disconnect everything but power: remove the expansion connector and unplug the motor.
  2. Power up your circuit. It’s safer to use a current limited power supply, and to ramp-up from 0V up to your application voltage.
    1. Are all power LEDs ON?
    2. Any flashing LEDs? Please refer to LED conventions & codes
  3. Connect your programmer/debugger (MiniProg3) and make sure that you can program the microcontroller.
  4. Open main.h and check your project configuration. This is what I have as a starting point (see Understanding main.h for more details):

The first step is to disable as many modules as possible. To debug with the GUI, I would keep USE_USB, USE_COMM & USE_I2C_1 only. Program the board and make sure that you can launch the GUI and see some of the sensor values (you should be able to read voltages and temperature). Add USE_I2C_0 and USE_IMU, but do not enable external I2C sensors (comment out USE_EXT_I2C_STRAIN, USE_MINM_RGB and USE_AS5048B). Try it: gyroscope and accelerometers should work.
At this point you can connect the Expansion connector and enable external I2C modules one by one. Once you are done with I2C sensor you can do the same procedure for SPI sensors, and any other peripherals. Hopefully this will allow you to identify what’s preventing your code from working. Please take a look at Debugging FlexSEA-Execute with the MiniProg3 for another debugging strategy that can be used by itself, or in combination with what is covered in this post.

Controller tuning with the In Control tool http://OFFLINEZIP.wpsho2016/05/26/controller-tuning-with-the-in-control-tool/?utm_source=rss&utm_medium=rss&utm_campaign=controller-tuning-with-the-in-control-tool Thu, 26 May 2016 17:33:09 +0000 http://OFFLINEZIP.wpsho?p=300 Read Now]]> Why is there a dead band in my controller? Why isn’t the integral gain compensating for this steady state error? The In Control tool will allow users to easily visualize what’s happening in their control loops.
*** Work in progress ***

FlexSEA Design Files http://OFFLINEZIP.wpsho2016/05/20/flexsea-design-files/?utm_source=rss&utm_medium=rss&utm_campaign=flexsea-design-files Fri, 20 May 2016 14:35:30 +0000 http://OFFLINEZIP.wpsho?p=277 Read Now]]> Disclaimer: ***ToDo***
Names and versions:

  • FlexSEA-Execute: PWR_STG_0_1 (2013), PWR_STG_0_2 (2014), FlexSEA-Execute 0.1 (2014), FlexSEA-Execute 0.2 (2016)
  • FlexSEA-Manage: MiddleMan 0.1 (2014), Manage 0.1 (2014)

PWR_STG_0_1 (2013):

PWR_STG_0_2 (2014):

FlexSEA-Execute 0.1 (2014):

FlexSEA-Execute 0.2 (2016):

MiddleMan 0.1 (2014):

FlexSEA-Manage 0.1 (2014):

Manage Prog Adapt 0.1:

Execute Prog Adapt 0.1:

Source code:

Note: WordPress doesn’t allow me to upload zipped files. Please change the extension from .txt to .zip when needed.

Programming Adapters http://OFFLINEZIP.wpsho2016/05/19/programming-adapters/?utm_source=rss&utm_medium=rss&utm_campaign=programming-adapters Thu, 19 May 2016 18:29:16 +0000 http://OFFLINEZIP.wpsho?p=264 Read Now]]> FlexSEA-Manage and FlexSEA-Execute require special programming adapters (shortened as Prog Adapt) because the cables and connectors used on the MiniProg and ST-Link programmers/debuggers are too big. They are very simple circuits, simply connecting a big connector to a small FFC connector. By convention we use the FFC cable “facing down” (conductors facing the PCB) on both ends of the cable. These FFC cables have a 0.5mm pitch, you need to handle them carefully (do not force them, make sure they are perpendicular, do not bend them too much, etc.). If you are planning on programming the same circuit many times it is recommended to hot glue the Prog Adapt in place and to connect/disconnect the ribbon cable (the one that came with your programmer) in your experiments.
Hardware files available at FlexSEA Design Files.

FlexSEA-Execute 0.x:


FlexSEA-Manage 0.1:


Using the FlexSEA GUI http://OFFLINEZIP.wpsho2016/05/17/using-the-flexsea-gui/?utm_source=rss&utm_medium=rss&utm_campaign=using-the-flexsea-gui Tue, 17 May 2016 14:36:40 +0000 http://OFFLINEZIP.wpsho?p=239 Read Now]]> Important: we are currently working hard on adding functionality to the GUI. A major code reorganization is planned (to have a cleaner, more object oriented project) for the coming weeks. Any GUI documentation or screenshot will be outdated by the end of today… This post contains only a few tips and tricks.

Getting started, launching the program:

  • We do not have an installer for the GUI; you have to compile it from the sources. All the details are in Installing the FlexSEA GUI Development Tools. All of the info below assumes you are using Linux.
  • Open a terminal and navigate to your build/release directory (in my case it’s ../FlexSEA-Git-Exp/FlexSEA/execute-gui-1/build/). You should see ‘execute-gui-1’.
  • To avoid COM port permissions issues we launch the program in root mode: sudo ./execute-gui-1. Keep the terminal open and visible, it will display useful information.
  • You should now see the config tab:


Connect your board:

  • Connect a FlexSEA board to your computer via USB. If you are using a VM, make sure that it sees your device. dmesg -T should list it. Note the COM port (typically ttyACM0). Example:
  • dmesg
  • Make sure that the right COM port and Slave are selected. Click Open COM and wait for ‘Success’
  • At this point you are ready to use the GUI. Explore the different tabs!

When it doesn’t work… and other pieces of advice:

  • In the current software version the PSoC only tries to connect to USB at boot. It’s easier to get it to properly work with your VM if you are in it when you connect the USB cable.
  • Always keep the terminal open to see what’s happening.
  • If you can’t connect, or you keep getting “No bytes”: 1) Make sure that you selected the right slave, 2) Make sure that you are using the same software version on the two devices and 3) power cycle (turn off battery power, disconnect and re-connect USB).
  • Sometimes it takes a few seconds for Stream to start. Monitor the terminal window; if you see at least one “48 bytes read” be patient and it’ll start working.
  • The Plot window refreshes at 35Hz. Keep that in mind while analyzing signals.
  • Always close the GUI before disconnecting USB.

Example #1: read Execute’s sensors:

  • Connect Execute to your Linux computer via USB. No battery power at this time.
  • Launch the GUI (sudo ./execute-gui-1)
  • Open the COM port. Make sure it says ‘Success’
  • Click on the Execute tab and click on Stream ON. You should see values refreshing. Execute’s RGB LED should also be steady Green.


  • Apply battery power if needed (please note that many analog readings are wrong on USB power, as we are not getting exactly 5V)
  • You can plot variables in the Plot tab.


Tools and hardware needed http://OFFLINEZIP.wpsho2016/05/17/tools-and-hardware-needed/?utm_source=rss&utm_medium=rss&utm_campaign=tools-and-hardware-needed Tue, 17 May 2016 14:32:41 +0000 http://OFFLINEZIP.wpsho?p=235 Read Now]]> FlexSEA-Execute:

If you start with a brand new Execute board you’ll need to solder wires for the power supply and motor (Preparing the FlexSEA-Execute 0.x board (Hardware)). Any AWG16 wires can be used, but we typically use high-flex wire. The connectors you use depend on your requirements. For our prototypes we often use Anderson Powerpole® Stackable Connectors with 15A contacts (we buy them from Powerwerx). Hobby/RC style Bullet connectors can also be used.
To program the board you’ll need a MiniProg (CY8CKIT-002 PSoC® MiniProg3 Program and Debug Kit, 83$ on Digikey) and a ProgAdapt. To connect to your computer use a USB Micro-B cable.


To program the board you’ll need an ST-Link (ST-LINK/V2 in-circuit debugger/programmer for STM8 and STM32, 22$ on Digikey) and a ProgAdapt. To connect to your computer use a USB Micro-B cable.


Both Manage & Execute use the same Molex Pico-Clasp™ connectors. The connectors and crimps are dense (1mm pitch), easy to use, support 1A per contact, and are economical (Digikey part numbers: WM7931-ND & WM10136CT-ND). The only issue with them is the expensive tool needed to crimp the wires: Molex 63819-1500 (296$ at Mouser345$ at Digikey). Please let us know if you find a cheaper alternative for this tool.
Full 63819-1500 datasheet (includes details about how to use the tool)
For wire I like to use the 6710 series from Alpha Wires, also available at Digikey.

Qt and VirtualBox http://OFFLINEZIP.wpsho2016/05/17/qt-and-virtualbox/?utm_source=rss&utm_medium=rss&utm_campaign=qt-and-virtualbox Tue, 17 May 2016 14:03:18 +0000 http://OFFLINEZIP.wpsho?p=231 Read Now]]> VirtualBox can be used, instead of VMWare, but a few issues can arise. The notes below cover the problem we encountered.

Install Git and get source files http://OFFLINEZIP.wpsho2016/05/16/install-git-and-get-source-files/?utm_source=rss&utm_medium=rss&utm_campaign=install-git-and-get-source-files Mon, 16 May 2016 13:27:29 +0000 http://OFFLINEZIP.wpsho?p=225 Read Now]]> Download and install the latest version of Git.
Windows:  https://git-scm.com/download
Linux:  sudo apt-get install git-all
All the source files are available on GitHug: https://github.com/JFDuval/FlexSEA. I’m currently working out of the Experimental branch: https://github.com/JFDuval/FlexSEA/tree/experimental
Navigate to where you want to put your working directory (/Documents/ is a good choice) and create an empty directory named FlexSEA-Git-Exp (name doesn’t matter).
Windows only:  Right click on this directory and select “Git Bash Here”. It will open a special terminal that works just like your typical Linux terminal.
Type git clone -b experimental https://github.com/JFDuval/FlexSEA/. It will download a copy of the experimental branch (that’s what -b experimental does) of the sources to your computer. Open that directory, and you should see FlexSEA, containing all the sub-projects.
Please refer to Software tips and tricks if you have Git questions.