Hi,
I have two Wixels, I’ve run the apps and everything is fine.
Pololu have done a fine job with the Wixel. The sample comms apps make it very clear how to develop apps with wixel on a budget.
Development through the use of a terminal for debug is okay but it can be tedious. I usually make small changes to the code and retest. Its okay, but I end up having to start/stop the terminals quite a lot - after a few iterations it can be a pain. If I have two wixels connected together, eg one as an SPI master and the other as an SPI slave its all too easy to end up sending code to the wrong Wixel - sooner or later something will go bang!
To automate the process in a safe way I run the following batch files which I would like to share with the forum.
They make use of a clever feature in the Pololu command line utility called wixelcmd which is capable of identifying the wixel by serial number before sending code - its been discussed elsewhere.
You will see later I’ve started experimenting with the makefile to see if I can do the same thing via make, but I am running into problems.
Anyway, for my system here are the batch files, xm.bat for the wixel master and xs.bat for the wixel slave.
xm.bat
rem xm (master node)
rem %1 is the application name in the apps directory
rem build the program
cd w3
make %1
rem program the wixel
wixelcmd write apps/%1/%1.wxl -d 2E-E5-98-C7
sleep 3
rem start Putty - putty is configured for wixel1 on com port 34 no echo
start cmd /c putty.exe -load "wixel_34_ne"
cd ..
thats Wixel1 reprogramed and Putty terminal1 running.
xs.bat
rem xs (slave node)
rem %1 is the application name in the apps directory
cd w3
make %1
wixelcmd write apps/%1/%1.wxl -d 24-F5-DB-66
sleep 3
rem start Putty - putty is configured for wixel2 on com port 30 no echo
start cmd /c putty.exe -load "wixel_30_ne"
cd ..
same but for Wixel2.
It’s easy to take this a stage further. I could program two at the same time like this,
rem x.bat
call xm spi_m2
call xs spi_s2
Not bad, it does the job in just a few seconds.
So what’s the problem?
I cannot run the batch files from the same directory as the Wixel makefile. If I do I have problems running make - it tries to build my batch files.
On my system the Wixel SDK is located at d:_ws\w3. so I run the batch files from d:_ws - this explains the w3 references in the batch files. Change the batch files for yourself as required.
You will need to identify the serial numbers of you own wixels by running, wixelcmd list from a command line. Change the batch files for yourself as required.
Its easy and worth trying even with one Wixel.
Enjoy.
Doing the same with the makefile
I thought it might be better to add a new command to the makefile instead of using the batch files so to start I modified the apps.mk makefile by appending the following lines,
#placed at the end of apps.mk
.PHONY : xm
xm : apps/spi_m2b/spi_m2b.wxl
wixelcmd write apps/spi_m2/spi_m2.wxl -d 2E-E5-98-C7
sleep 3
start cmd /c putty.exe -load "wixel_34_ne"
Now the problems begin
Make responds,
D:\_ws\w3>make xm
wixelcmd write apps/spi_m2/spi_m2.wxl -d 2E-E5-98-C7
Sending command to get Wixel in to bootloader mode...
Waiting for Wixel to reconnect...
Erasing...
Progress: |##########################################################| Done.
Writing...
Progress: |##########################################################| Done.
sleep 3
start putty.exe -load "wixel_34_ne"
/usr/bin/sh: start: command not found
make: *** [xm] Error 127
Why should start work fine in a batch file but fail when it is run by Make?
I noticed /usr/bin/sh: in the response - this looks suspiciously unix-ish. The build tools listed in the SDK package are part of the GNU toolset so I thought you might be using Cygwin. After a fair bit of Googling I managed to find cygstart hoping to try this as a possible replacement for start but that did not work either.
So my first question, how do I get start to work?
The batch files work fine but it would be good to get the makefile working.
Hopefully its an easy fix, but I’m pushing the limits of my knowledge on makefiles. I would be glad of your advice - more questions to follow.
Kind regards,
Brent