Friday, November 12, 2010

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.