Friday, November 26, 2010

Nov.26,27 Dev Env reinstall

My Laptop's network adaptors stopped working. The reason is not clear - virus/trojan or deleting the files for a Virtual Machine manually - but get to do an install of development environment on a clean system. So...


updated Nov.18+26 Tutorial Dev Environment Summary with new information learned like:
  • Installing gnuarm added cygwin location correctly to the windows registry
  • c:\local\bin; had to be added manually to the window path for the eclipse compile to work correctly
  • Testing arm-elf-insight caused the firewall to ask for certain features to be blocked/unblocked.
    • Not blocking solved a previous problem where the gdb GUI did not work.
  • Added links for serial download. Wondering how this .bat file and source should be packaged for the tutorial.
  • At one point from make all in eclipse got the error ld error message "uses hardware FP, whereas forte uses software FP". Still not sure what combination caused this error message.
  • Installed gnuarm 4.1, cygwin 1.7, java 1.6.0_22  in C:\local, because wrongly thought there was a problem, C:\Program Files, has a blank in the name. Some older notes said Forte does not work with blank in file name. Still good having the tools in one place, since hope to create a zip with tools needed.


Thursday, November 18, 2010

Nov.18+26 Tutorial Dev Environment Summary

Links for setting up tools needed: 
  • Java SE6
  • Build Environment 
    • cygwin
    • add cygwin/bin location to the path 
    • installing gnuarm set the window registry entry needed for cygwin 1.7 for use with eclipse
  • Eclipse with C-Development Tools (CDT)
  • FORTE
  • 4DIAC-IDE 
Other
  • loop-back device 
    • install check: Device Manager => Network Adaptors => MS Loopback Device
    • needed for virtual network on 1 PC with 4diac/forte
Cross-compiling and debugging for ARM
  • GNUARM includes arm-elf-insight for debugging
    • used: binutils-2.17, gcc-4.1.1-c-c++, newlib-1.14.0, insight-6.5, setup.exe
    • install check: 
      • 1. echo $PATH Your install directory for /gnuarm/bin should be in the path.
      • 2. in a cygwin command window enter arm-elf-insight. The GNU GDB RedHat Source Window should appear.
        • arm-elf-insight GUI will not work if blocked by firewall
    • Cross-compiling in eclipse
      • use arm-elf-g++
    • Debugging with GNU GDB arm-elf-insight forte 
      • open a cygwin command window
      • cd to the directory with the forte executable
        • ex: cd /cygdrive/h/lms/bin/src/forte
      • enter arm-elf-insight forte
      • GUI Source Window opens
        • Run > Connect to Target: (for Segger JLINK)
          • Target: Remote TCP
          • Hostname: localhost
          • Port: 3333
        • View > Console
          • monitor reset
          • monitor halt
        • View > set breakpoints
          • max of 2 breakpoints for lms
          • max of 1 breakpoint when stepping through code
Flashing the LMS
    eCos, Samba, usb Drivers are needed for the following:

Nov.17 OpenOCD install tries

1. The drivers sometimes revert back to the first driver installed:
see previous Nov. blog entries for driver details
  • Ports(COM&LPT) ecosUsbSerial to libwin32usb/ecos usb driver
    • need a COM port for forte deployment FB download
  • Universial Serial usb controllers/atmel driver reverts to Lego device/firmware update mode
    • need  atmel driver to flash via sam-ba
2. openocd on my laptop
The correct way to install will be documented in a separate blog entry.
Try1: Just copy directory and usb.dll needed to my laptop. Not enough.
Try2: Find out what first praktikat used.
Found link to install .msi file that is no longer actual, but google found: 
Search in this website for OpenOCD Windows installer lead to a current list of installers 

Question:
What is a FTDI type chip which needs libusb?
libftdi is a library that talks to FTDI's FT232/245BM, FT2232C/D, and FT232/245R type chips, including the popular bitbang mode
Answer: See OpenOCD user's guide... FTDI type chip is used in some JTAG doggles, but not in the Segger JLINK.
If understand right then libusb doesn't have to be installed.
However for the Raven it is needed.

So it is not possible to use the version the first praktikat used.
openocd  -v says Alex used 0.3.0-in-development version.
A website with a list of openocd Windows installers says 0.3.1 has important fixes
so...
Try3: install openocd 0.3.1 using an .msi installer found online
Installed with no problem from zip.
All files needed are in the zip.

Wednesday, November 17, 2010

Nov. 17 Line Follower Algorithms / Beginners

Each week I meet with 2 friends, so they can learn about Lego Robot one of them recently bought.
Today we accidently found a simple algorithm that looks for the line and then follows it.
The line follower allows lots of algorithms.  First two friends downloaded, tried and looked at existing NXT-G programs. In the end they could somewhat follow the program, but could not make even minor changes successfully to the program. 
Today we started with basics. Motors block; Loop testing light sensor or looping forever;  If-then-else branch block.

[Picture of algorithm goes here]
The idea was:
Step 1: Go when see white, stop when see black. 
Loop while see white
Then stop
Step 2: Loop forever
If-then-else branch for light sensor:
IF white
THEN: forwards
ELSE: turn x degrees

We found when it found the line when x was around 45 degrees, the robot would follow the edge of the  line if it was on the correct edge for the direction it should go in. Since blue was seen as black, it lost the line at the blue box.

The Video shows the attempts starting with 90 degrees, then 45 degrees, then 25 degrees.

[VIDEO(S) COMING]

Monday, November 15, 2010

Nov.15 OpenOCD Flashing on AA PC

TODO
Get a version with export 4.0 working with FBs!
SEGWAY


1a. OpenOCD  is part of the gnuarm toolchain. 
OpenOCD does not have offical releases, but some stable releases are available. It was easiest to copy the OpenOCD in the on Alex's PC to my laptop and add it to the path. Unfortantely its not clear where this working version came from orginally.

1b.Support for mulitple versions of forte.bin at once.
Created a flash_forte_bin directory to copy forte.bin and forte to for use with openocd bat files.
New bat file:  cp_Oflash.bat
Now
C:\openocd\trunk3\testing\examples\SAM7S256Test\prj\sam7s256_flash_Q.cfg file is also hard coded to this directory.

2. CBC/Scheme

- plug in keyboard and display
--  result: CBC booted the same.
    It didn't seem to be aware of the keyboard or display automatically.
- kernel # for ubuntu10.4 is at least 2.6.32.9
-- if kernel is new enough the CBC Linux driver is included
--- (11/17 note: interesting the driver link is same those doggles needing usblib)
- Can't use CBCJVM - Racket has its on Racket machine bytecode

Botball has another language forum. Only Java seems to be doing anything.

Friday, November 12, 2010

Nov.13 How to update driver

1. Right click on the device and choose Update Driver
2. Again choose Update Driver and OK
3. Choose Browse my computer for driver software


4. Enter the directory with the .inf and .sys driver files
5. If driver is installed chose the second option and a list of installed drivers for the device will show-up.  Then you are ready to test in SAM-BA.


Nov.13 Can flash with Sam-BA from laptop!

 Again an already installed driver interfered. 
This time the (normal) LMS driver from Lego company.
So there will be separate blog entry for how to update a driver.

To install the driver and flash the lms using SAM-BA:
1. Plug in the lms in boot mode
2. The driver files directory with the  .inf and .sys files is found under:
 Program Files\ATMEL Corporation\AT91-ISP v1.13\sam-ba 2.9\drv
After installation this driver should show up in the device manager:
3. Open SAM-BA .
The first time the board at91sam7e256-ek must be choosen.
Then hoose the forte.bin to send to the lms to flash its memory.
 Unlock - yes  then afterward lock -no

Nov.12 eCos USB device

Refer back to the  Oct.13 Lego, ecos, Samba and usb Drivers

Two problems solved!
1. Two characters were exchanged in a new parameter in LMS_RMT_DEV.c
This caused usb to not be set-up correctly.
Symptom was the lms was not recognized as an eCos device

2. To install eCosUsbSerial driver
refer back to the  Oct.13 Lego, ecos, Samba and usb Drivers 

Origin of eCosUsbSerial.inf is probably from eCos itself. Specifically:
        packages/io/usb/serial/slave/current/host/windows: 
                                                           eCosUsbSerial.inf 
See:

The copy given us is in the directory \libusbdriver, but LIBUSB (sourceForge) is not needed.

On my laptop having installed the LIBUSB sourgeForge project confused matters. The usblib driver had to be replaced.

Nov.11 JTAG,openocd, arm-elf-insight revisted

Details so can change to use with forte not in 1 place or copy to a common place.

JTAG - the picture shows the connections best. Note the black line goes toward the outside.
openocd - FLASH.bat is hard coded to a specific directory with forte and forte.bin
uses
C:\openocd\trunk3\testing\examples\SAM7S256Test\prj\SAM7S256_flash.cfg  is also hardcoded to a specific directory.
Note: multiple openocd's installed so notice trunk3 is the version used!


arm-elf-insight from cygwin 
openocd.bat  must be running before arm-elf-forte is started.


In a cygwin window:
1. cd to directory with forte and forte.bin
2.  enter arm-elf-insight forte

     The gnu debugger opens
3. Connect to the device (run-->connect to device) using ethernet / localhost / 3333
4. Open console (view-->console) and enter:
  •      monitor reset
  •      monitor halt 
    • stop  button if want to restart this process later]
5. Set breakpoints  (view-->breakpoints)
- at most 2 breakpoints are allowed
- at most 1 breakpoint if you want to examine variables
6. Continue to start debugging




Sunday, November 7, 2010

Nov.5 forte.bin to get an eCos device

When/how is forte.bin is built, so the flashed Lego brick is recognized as an eCos device;  Not which driver is loaded, but that the PC knows a new device has been plugged in.

This is important because the usb download will not work if the Lego is known to the PC.

The following documents what is known so far.
0. Looked at the command to create the forte.bin in the 2 working versions and in current hg
- no difference that I could see (it was late)

1. Known as eCos device = works
Windows XP recognizes the Lego Brick as an eCos Device

* Summer lms version
* Forte Version of Dominik's from Oct. BUT
in lmsmain: 
  code to create lms device commented out
  added in his own main method

2. Unknown as an eCos device  = does not work
Windows XP does NOT recognize the Lego Brick as an eCos Device:
* hg forte out of the box with the same FBs as in Dominik's
* hg forte with lms device commented out
* hg forte with just code to blick led in the main
   (I hope device was commented out - but going on memory at the moment)
   [will check and update]
* my cleaned code version

3. Next tests = try and see if the flashed on Lego -forte.bin  goes from known to unknown or vice versa.
(Ran out of time Friday night.)

known to unknown
- Uncomment the code to create the device in the Dominik  version

unknown to known
- put the main, utilities and BT fb code in the current hg version

If neither test yields anything new... then start a code compare

4. Other info:
After flashing the Lego the device, take out the battery and put it back in.
After about 25-30 sec. the Lego will click. Then the PC will show the Lego as an eCos device or it never will know the Lego is plugged in.  The 25-30 sec. is slightly longer than the normal boot blinking in lmsmain. After this click the Lego is either known/never known, independent of the contents of lmsmain.

Thursday, November 4, 2010

Nov.4 HW / Ports

Dominik using Windows 7 - the same Lego 
Alex's PC the Device Manager shows:
JTAG LINK as Universal Serial Bus controllers --> J-Link driver 
  • in the middle between the list of USB2 Controllers and USB Composite Device
eCos Lego 
= flashed with forte.bin with eCos included 
  •  (com3, com4, com5)



Samba
  • Put the LMS in reset mode, then plug in USB to PC so:
    • the Atmel Samba device driver is used
    • the LMS is not recognized as eCos or Lego device 
      • if its device driver is loaded,  then it shows up as a COM device, which is wrong!
      • so it is recognized as a USB/ARM0 device ready to be flashed

     

    Nov.4 Touch Sensor as Button Applications

    E_CYCLE is better to use than E_DELAY in many cases:
    • E_CYCLE: Sends sample request at regular intervals, independent of other FBs
    • E_DELAY: Waits a specific length of time. A total sample cycle time can be influenced by the time variance in FB execution times.
    Simple example: Touch sensor as start application button 
    E_CYCLE + E_PERMIT
    E_SWITCH+E_DELAY

    Nov.4 IEC 61499 LMS "Segway" application

    Here is a IEC 61499 LMS "Segway" application ready to be tested.
    Test results will be posted here.

    Wednesday, November 3, 2010

    Nov.3 Clean lms 4diac Pallete

    Clean lms 4diac Pallete on AlexPC - not compiled/tested  AND needs PID1 FB before Segway

    Since there doesn't seem to be any copy of the LMS Sept. workspace where the System Manger works, need finish moving the working/finished LMS Function Blocks to their own clean local hg repository. clean = no extra code + use of static const

    4DIAC-IDE managed somehow to get the same FB type (PID1) in the same group. Since good copy was lost, just deleted both copies and started over.

    forte1103 lms pallete FBs with working code from summer:
    • OFF(was shutdown); 
      • added message sent via USB back to 4diac "LMS OFF"
    • LED; 
    • LT (was RD)
    • TOUCH; 
    • SOUND; 
    • M_PWR (was motor.basic)
    Clock skew problem on Alex's PC (slow clock) is annoying since build leaves a directory when it sees it. 
    Cause: Files copied from a computer with a normal clock time.
    Solution: Wait the 10 minutes the PC clock is behind and the problem goes away.


    cntlr.PID1 Basic FB 
    Kp=25,Ki=1,Kd=10 values taken from LMS NXTG "Segway" code 
    Since the FB has been lost due to 4DIAC several times a screen capture backup - PID1 is currently in the Nov lms directory. The FB should work, but is not polished.
    • Several "Segway" application versions. 
      • Refining how to get the desired value = first read
      • Should LT FB should do its initial read when INIT event is sent?
    • PID FB 
      • Does it need an event when OUT is out of reasonable range is QO= false enough?
      • or is a separate event needed?
    • M_PWR
      • Similiarly is STOP event needed when finished with motors?
    Created sample applications for:
    • Using touch sensor as start button 
      • T_SWITCH:    with E_DELAY and E_SWITCH 
      • T_SWITCH2:: with E_CYCLE and E_PERMIT
    Tutorial0 for Blinky restructured  in usb wiki

    ECC interface is a mixture:
    event & condition in structured text 
    so might need both &s and ANDs
    ex. REQ & ((-1000 <= OUT) AND (OUT<= 1000))

    Tuesday, November 2, 2010

    Nov.2 KISS CBC day

    Dave Miller gave a quick introduction toBotball CBC robot.
    Its UI is touch screen.   Download is similar to Lego NXT.
    We did the typical first time things. Move the motors and follow a line.
    The function to start the motors returns as soon as the motors are started.
    Later a separate function can be set to wait for the motor function to complete.

    BUT BC Botball has a very nice camera which works as a color light sensor.
    The range of light is chosen from a spectrem, not restricted to ranges or 3 colors. 
    Also you see a picture via the camera and can see what it is detecting.

    For Thursday its hoped I can get a Scheme language interface workng on CBC.

    Sunday, October 31, 2010

    Oct.31 LMS 61499 Segway is possible now!

    This application can be created now with the existing LMS FBs


     Hardware:
    • Light Sensor
      • red light turned on 
    • 2 Motors
      • adjusts based on PID
        • direction  forward/backwards base
        • duration based
    • Ultrasonic Sensor - not connected - used to look like a head.
    Two topics:
    1. NXT Segway description vs. actual results
    2. What is needed for a lms event driven (IEC 61499- fordiac) Segway?


    1. NXT Segway description vs. actual results
    The NXTprograms NXT Segway with Rider   "This robot simulates a Segway PT "
    The project construction was straight forward. With the exception of the axle between the wheels, parts were easy to find and could be used as is. The axle had to be modified. The 2 wheels are connected so they move together to avoid drifting to the side.

    The Usage Information in the Building Instructions were extremely helpful.
    The NXT-G program worked as described and is well commented. And was it was nice surprise it worked on both a solid tan and solid gray surfaces with normal lab lighting.


    There are links to PID descriptions and alternative LMS self-balancing robots such as the
    alternative NXTway with both light sensor and gyro sensor versions.
    Fail safe: The program shuts off, if the PID value is not reasonable indicating it has probably fallen down.

    The blue tooth version is unique to this construction.


    2. What is needed for a lms event driven (IEC 61499- fordiac) Segway? 
    The basic NXT-G code / algorithm  is:
    1. Initialize using the robot's initial value as the goal value
    2. Adjust motors forward or backwards based on the PID correction 
    3. If the correction value unreasonable - Stop

    In theory this can work now in fordiac. The only known potential for error is, if the signal to motor is not sent timely. 1st Draft Application/Tests can use existing robot and lms FBs from summer.

    FBs needed:
    • Provided: 
      • E_CTU,; 
      • F_NOT; 
      • E_DELAY (3 pre-calibration/balance warnings); 
      • E_CYCLE;
    • lms pallete: 
      • LED; 
      • LT (read light reflection); 
      • MOTOR (sent power setting)
    • utility/ cntlr pallete:
      • PID; 
      • BTW (is # BeTWeen 2 numbers)

    Friday, October 29, 2010

    Oct.29 clean lms Forte; laptop dev; NXT-G Segway

    For break at the end: downloaded NXT-G NXT Segway with Rider  
    It works on solid gray desktop and solid tan table. Trick is balancing it well by the third beep.


    Note: Video edited and clipped with MPEG Stream Clip.

    clean lms Forte - continued creating a clean version of lms forte with minimum files


    Development on laptop

    The main open issue is how to install drivers so it works and Vista funnies.

    JTAG-edu : recognized by both Alex's PC and my laptop

    On Alex's PC:
    Samba ok following blog instructions for flashing
    OpenOcd let me flash

    On Laptop:
    LMS:   recognized as a libusb-win32 device --> eCos USB Serial Device
    It only shows up after the boot squence blinking if finished. When Forte adds the LMS_DEVice.
    Sometimes thought eCos device was Lego... then could flash it through LMS Firmware update back to Lego. Still don't have a pattern how Windows choses a  device driver!

    BUT Sam-Ba doesn't see it.  (main open issue!)
    Sam-Ba 2.9 sees JLink, but not the .-.l--ö-------------------------------ööööööööööööööööööööö----ö-öö_
    !
    Miscellaneous Links: 
    Flashing LMS with SamBa
    Sam-Ba for Vista: (installed on laptop)
    specifically:


    Driver info: USB CDC/ACM Class Driver for Windows 2000, XP, Vista, 7

    C++ style links: http://www.possibility.com/Cpp/const.html

    Interesting "Examples":

    MakerLegoBot: Lego Mindstorms NXT 3D Lego Printer

    NXT Segway with Rider (also with tilt control via BT) 

    Sideline: Dave Miller from KISS BoeBot is here and will hold a workshop Tue at TU and Th. at TGM.   Will possibly try to install (PLT) Scheme on CBC.

     

    Oct. 28

    Finished building the basic 4DIAC/FORTE on stick.
    And used the 4DIAC on the stick to create and export 4 lms FBs (OFF, LED, TOUCH, LT).

    4DIAC-IDE (minor) problems
    same old problem:
    It requires you exit and enter to see new Systems; Type groups; and export filter.
    This can definitely confuse new users and is annoying, but must be included in Tutorials.

    Blanked out  author field in properties of new SIFB, so no author tag was filled in. Exported the SIFB fine, but next time re-entered IDE it gave a java null pointer error. Added the tag in manually. It appeared to work at first, but may messed up some internal db. Now the type group never shows up in the drop-down when creating a new FB in Type Manager. However the group name can be typed in and appears to work fine.

    LMS arch/ecos C++ style - #defines vs. constants
    Used #define s in summer since that is what Atmel include uses. After short discussion.. if its a number then will change to a constant, if it reads or writes - then will use #define. However #define will be used in a method, except in lmsmain. For lmsmain, fast is more important, but using #defines lets the same code be used to initialize leds.

    Wednesday, October 27, 2010

    Oct.27 new LMS Forte cont.

    4diac-ide clone from hg works. Forte from clone hg needs minor changes.
    At moment many  more FBs are compiled by forte than LMS's limited memory can hold.
    Changing configure.in and makefile.am so conditionally compiles only what LMS needs.

    Initially a 64bit #define flag was not set in a forte file - which caused an error. (corrected)

    Then added an use_lms conditional to configure.in and used in set-up shell script and makefile.am, so only function blocks needed by lms are compiled.

    In process a hg clone repository has been set-up on Q a common hard drive, so changes to be pulled into the official web-hg version. Local clones are being tested on laptop, aa, and usb stick.

    The goal is a set-up where different hardware device interfaces can be tested at the same time a version with finished hardware interface and function blocks is being created, tested and used in labs etc.

    Monday, October 25, 2010

    Oct. 25+ LMS Passive sensors and IEC61499 adaptors

    Should IEC61499 adaptors be used /taught? 
    Using:
    • LMS passive sensors 
      • raw value read = 0-1023, but FB interface output variables might return:
        • raw value
        • extracted value like True or False
    • All LMS Sensors
    Commonality:
    • All Sensors:
      • INIT event:
        • reserves PORT# to the first sensor FB type
    • Passive Sensor Read Value
      • Sensor value read internally is always 0-1023
      • 0 if no sensor is plugged in
      • If FB says its touch sensor, but light sensor plugged no way to flag as an error


    Oct.25 LMS 4DIAC-IDE and FORTE on a stick

    Creating a version of 4DIAC-IDE and FORTE already set-up with LMS Palette.
    It should be  a zip that can be used as soon as its extracted even on an USB stick.

    4DIAC-IDE 
    • clone from hg (synchronize, test, export)
    • copy into 4DIAC-IDE directory:
    • template directory from hg 
    • typelibrary with default configuration FBs
      • working on lms palette to be included with:
        • OFF- turns the LMS off (=shutdown)
          • OFF is a shorter name than shutdown
        • LED- light sensor led
        • TOUCH
        • LT (reads light sensor value)
    • set preferences 
      • looking into using system variable for current path in 4diac-ide code: 
        • org.fordiac.ide.fbrtLauncher\src\org\fordiac\ide\fbrtlauncher\preferences\PreferenceInitializer.java
      • FORTE
      • FBDK 
    • export all lms /lms FB types

    FORTE
    Stage 1: (compile hg version)
    • clone from hg
    • copy in ecos include and lib directories under bin/lms directory
    • run setup_lms.sh
    • run bin/lms/make all 2-3 times until only get a compile error
    • change src/makefile.am to include the whole lms pallete and only FBs needed 
      • see if easy to add lms conditional variable to configure.in
    • E_SWITCH
    • E_CYCLE
    • E_RS
    • E_SR
    • E_CTU?
    • E_DELAY?
    • run bin/lms/make all 
      • Note: This executable will do nothing yet because  lmsmain.cpp still has the empty default code.
    Currently HERE
      Stage 2: (compile to run on lms) 
      • copy in the src/arch/ecos/lms the minimum files needed:
        • lmsmain.cpp
        • arv_ctl.c / .h
        • i2c_at91sam7sxxx.c / .h
        • Buttons.c/ .h
        • Port reservation files (sensor INIT service)
      • run run bin/lms/distclean
      • run bin/lms/make all until no errors
      • Flash LMS NXT with forte.bin
      Stage 3: Ready for lms HW FBs and user exported FBs and FB downloads via deployment 
      •  start USB ethernet bat
        • would be nice if bat file could be connected into deployment directly
      • deploy application to LMS NXT

      Friday, October 22, 2010

      Oct.22 Back to project progress blogging

      Daily progress will go in blog
      ... now summary information is being collected in the portable wiki not in blog entries.

      Environment changes:
      Virtual Boxs (Win7, Ubuntu) and portable Wiki  on different USB devices
      Want 4diac/forte also on a fast USB.
      (so can document when waiting on VB to start) 
      Built hg versions
      4diac hg:
      1. hg clone
      2. import into Galileo (modelling tools) Eclipse 
      3. syncronise, test, export to build 4diac-ide
      4. copy into the built 4diac directory:
        • hg template directory
        • typelibrary directory which will be used for default 
        • know where an fbdk is for 4diac-ide preferences
      Forte hg on:
      1. laptop C: and H: drives
      2. Alex's PC C: and Q: drives
      • lms set_up shell
      • make all 
        • need to edit make file so only FBs needed are included
        • Lab Nov. 8 Di. Blinky (Flip-Flop) 45 Minutes''' - need tutorial
      • Problems: 
        • cygwin errors when on USB
        • Spaces in directory or filename cause cygwin problems
        • cd to pwd will be removed from lms shell script
      Flashed LMS with SAM-BA by downloading Lego Firmware and sending it to Lego
      • VT1 (win98) saw it was an ecos device although no drivers installed
      • Plugged lms into laptop with ecos - had no idea any device was attached.
      • Plugged into laptop (WinVista) nothing!
      • Plugged into Alex's PC (Win98) and nothing at first. Powered on with reset button pushed. Then Sam-ba recognized it.
      Noted links in wiki to:
      cmake (easier to have makefile configuration per application) - coming to 4diac in Nov. (I hope)
      and hg to set up a repository and branches for lms fb palette.


      in Virtual Box: Win7
      Can LMS be used with standard LMS SW and downloaded from a Virtual Box (VB)?
      1.  Lego Mindstorm NXT 2.0 Software is installed in VB (not on host= laptop)
           Goal to program LMS and download program
      Did Program the LMS provided RoboCenter >Machines>Color Sorter example

      Connected the LMS to the laptop:
      • Host (Vista) reaction:
        • Installed unknown device
        • Couldn't find in device list, but when turned off device list refreshed
      • VB reaction:
        • crashed  
          • when tried to switch back to it in full screen mode. 
          • first a message about needing more memory
        • would not restart - gave error
        • restart of vista system ok
        • after restart: Win7 VB started in safe mode
        • after Win7 restart - able to program again.
      • Finish program - save after every step
        • Just like it did 2 years ago when I first used LMS - the UI is very, very slow and you can see everything. In this case the motor blocks at the end. 
        • Finished - but not tested
      • Will want to compare to what event driven program would look like.
      Snapshot of VB
      • Connected LMS to VB (check under USB devices)
      • It kept going on and off
      • Finally managed to start download while it was detectect
      • And ColorSorter.rbt downloaded from VB on to the LMS!!!
      • (details: lms ACIN = USB Devices> unknown device 0694:002)

      Wednesday, October 13, 2010

      Oct.13 Lego, ecos, Samba and usb Drivers

      • Lego NXT Mindstorms 
      • ecos
        • Put the following files in their own directory. 
          •  usbser.sys 
            •  C:\WINDOWS\system32\drivers\usbser.sys
            • hint in an ecos forum about ecos slave devices:  "For windows, copy the INF file and the 'usbser.sys' driver from your version of Windows into a directory, plug in the device, and when prompted, navigate to the INF file."
          •  eCosUsbSerial.inf
            • C:\sourceware_ecos\ecos-3.0\packages\io\usb\serial\slave\v3_0\host\windows\ eCosUsbSerial.inf
        • When Windows asks for the local of the driver. Enter this directory name.
      • Samba
      • libusb-win32
        • to create your own usb .inf and .sys for any generic USB device
        • NOT needed for LMS
        • libusb can be used with any good .inf and .sys files for usb devices

      Wednesday, October 6, 2010

      Oct. 5 Sampling - ECycle

      Started using EDelays just to get the applications to work when trying out the algorighms using GUI on PC for simulation. But on real device need to sample at regular intervals. Since EDelays do not guarentee time between samples because of delay time to execute other Function Blocks. 

      Better Solution: ECycle - sends out request at regularly timed intervals. 
      Of course the sample rate chosen must be greater than the execution time of all FBs used in the cycle.

      Wednesday, September 15, 2010

      Sept.15 PNP built

      PNP model (Lego Bonus Model #4)  that will be used as starting point for the 3rd tutorial has been built. Took 4.5 hours over 2 days (3+1.5). 


      Thursday, September 9, 2010

      Sept.9 LineFollower Video

      After creating an E_SPLIT4 to send events to both motors, led indicator, and light sensor reader,  
      the Simple Line Follower using forte 3.x works. It follows a straight line and curves in one direction. There may still be memory issues, but they take longer to show-up!

      I forgot to unplug the USB cable and it kept following the line after being unplugged!



      Forte IEC61499  LF1 Application:


      Tuesday, September 7, 2010

      Sept.9 Line Follower now

      Wanted to just run the line follower and make a video.
      But doesn't work because of changes documented here. 
      This is typical since the FBs for Lego NXT are not stable and there is too little space for FORTE.

      1.  To save space in FORTE the  HYST_UINT and calcBnd FBs were commented out in the src/Makefile.am Too bad can't connect the application XML and FB makefile.

      2. Names were shorten to fit in space available, but changed to longer names for documentation.  Must be changed back.

      3. Motor FB was updated to add STOP event.

      4. Seeing if changing to -O2 helps

      Still doesn't work... so more to come
      At least one problem was the JTAG cable connection

      Sunday, September 5, 2010

      Sept. 5 Media Wiki started

      One goal of this blog was to avoid having to ask the same question twice. But as I learn the same topic comes up multiple times, each time with more depth. So information is scattered over time or blog entries are no longer date related.  

      To solve this problem and provide a place to work on the (formal) tutorials, a media wiki has been started.  For better or worse this media wiki is not online. It uses MoWeS Portable, so it is a Wiki on USB stick.

      So far the tutorial outlines are in place with more details for Tutorial 1.

      Wednesday, August 25, 2010

      Aug.25 Timer Counter

      Next Step: See exactly what code examples use
      and understand what eCos wants to do for an application.

      Following are notes / summary of my understanding of ARM7 Timer Counters from:

      Color code: HighLevel; Register; Bit

      TCs can be pgmd to:
      1. freq measurement
      2. **event counting (like lms motor tacho count)
      3. interval measurement
      4. pulse generation
      5. delay timing
      6. pulse width modulation 
      7. interrupt generation
      Each channel has:
      • 3 external clk inputs=
      • 5 internal clk inputs= TIMER_CLOCK1-5; MCK/2 8 31 1128 1024
      • 2 multi-purpose i/o signals=
      • 1 internal interrupt signal = 33-2 Channel signal
      • (can be pgmd to generate processor interrupts
      with
      2 Operating Modes= DS p.444 / p.2 ApplNote 
      • Capture Mode  (measurement on signals) 
        • TIOA always output
        • TIOB 
          • usually output
          • can be selected as external trigger
      • Waveform Mode (wave generation)    
        • WAVE bit (=?) in TCx_CMR 
      Triggers
      3 common to both modes:
      • Software
        • set SWTRG bit in TCx_CCR
      • SYNC signal asserted. 
        • Asserted same time for all 3 channels 
          • "by writing TC_BCR (block cntl) with SYNC set(?)"
      • Compare RC Trigger
        • triggers "when counter value matches the RC value if CPCTRG is set in TCx_CMR
        •  (Does this relate to lms Schmitt trigger?)
      1 external trigger (per channel)
      • in Capture Mode:
        • selected via TIOA and TIOB
      • in Waveform Mode:
        • Signals that can be programmed on
          •  TIOB
          •  XC0, XC1, XC2
        • External event triggered by setting ENETRG in TCxCMR
        • *Duration of pulses must be longer than the system clock (MCK) to be detected.

      Clock Source

      Timer Interrupt Generation

      Tuesday, August 24, 2010

      Aug.23 Interrupt never invoked?

      Why is interrupt not called? 

      Easiest to correct:
      • priority is too low
      Since not comfortable with what eCos does and what is left to do likely...
      Either:
      eCos call to isr (interrupt service routine) 
      • match documentation?
      • match the structure of i2c working interrupt call
      or
      Commands to ARM7 to allow the interrupt are not fully correct.
      • check documentation
      • compare to examples of working code
      • via debugger check memory is really what expect

      Monday, August 23, 2010

      Aug.23 arm-elf-insight use

      Revisiting /redocumenting debugging with arm-elf-insight because:
      cygwin doesn't keep history between sessions anymore on lab PC, and found early debug description in March is missing details, as well understanding the process better now.
       
      Created simple script, so don't have to remember a long path name to forte:

      lmsdb.sh:
      cd /cygdrive/d/AA_local/eclipseWork/forte_lms_neu/bin/lms/src
      arm-elf-insight /cygdrive/d/AA_local/eclipseWork/forte_lms_neu/bin/lms/src/forte

      0. flash lms with fw code updates (flash.bat or Sam-ba)
      1. start openocd.bat 
      in cygwin:
      2. when lms is initialized (blinking led stopped), start arm-elf-insight using
      ./lmsdb.sh
      3. In arm-elf-insight:
      • connect to target 
        • remote tcp with port 3333    (for Raven JTAG != 3333 for example: 8888)
      • in (view) console:
        • monitor halt
        • monitor reset
      • select (view) breakpoints
        • 1 breakpoint only if want to step
        • 2 breakpoints max.
        • for Raven montitor set hbreak 0xaaaaaa
          • where 0xaaaaaa is address from breakpoint window
      4. continue
      5. start usb connection
      6. start application and wait for the breakpoint to be reached


      Miscellaneous Notes:







        Sunday, August 22, 2010

        Aug.22 eCos Configuration

        Open eCos LMS topics:
        topics may be added