Friday, April 16, 2010

Apr.16 Firmware Flashing

Use an open paperclip or similiar to push the reset button under NXT
when clicks NXT is in reset mode

From Lego Mindstorms Software
in NXT window update firmware from Lego Mindstorms package
  also loads Lego firmware if following firmware is on the NXT: lejos

Samba mode

Tuesday, April 13, 2010

Apr.13 gdb via arm-elf-insight forte

1.  Change gcc optimize level to -O0 from -O3
make dist clean followed by make all

Note:  FORTE grows from around 160k to 230k so lower levels of optimization only help for very small applications since 256k is max available.

1b. run openocd_flash.bat 
2a. run  openocd.bat

2b. In cygwin start:  arm-insight-elf 

current path: (if gdb does not remember for you)
aa@automatix /cygdrive/d/AA_local/eclipseWork/forte_lms_neu/bin/lms/src
$ arm-elf-insight forte

3. In gdb 
  • run connect to target
  • wait
  • in Console window:
    •  monitor reset
    •  monitor halt - so can set breakpts
    3b. Set breakpoints
    No more than 2 breakpts, since chip only allow 2 breakpoints
      and only 1 breakpoint, if you want to step because 1 breakpt is used for stepping
    •   select source file 
    •   -    next to a line indicates where breakpoints are possible
    •  click  on - to set breakpoint for a line
    •  verify via view/breakpoints 
    • delete extra breakpoints
    Note: if drop-down for select source has disappeared, close all windows except source (main) window and  console window;  exit gdb; restart in cygwin
    4. after settting the breakpoint  then...
    • continue (far right of run symbol)
    • wait for  boot to finish indicated by: blinking / sound of a device connecting to PC
    5.  run download program in java eclipse
    6.  download application from 4diac
    Stops running at breakpoint
    7. examine state at breakpoint
    can now view/ local variables or watch
    QI is really a #define
     so use the form this->mpapp0DI[0] for watch expression

    NOTE: C++ will not compile if gdb is open!

    Monday, April 12, 2010

    Apr.8- 22+ Checking out LMS HW from FORTE

    Basic tests finished, HW working from FORTE code


    Open Questions left:
    Apr.22 Light Sensor Clean-up
    ltsensor.rd FB (test appl(s):  blinky3rd)
    test: black/white/brown  + led on/off 
    Sensor 3 returns 1020 no matter what with light sensors plugged into ports 1-3
    All sensors return a value around 1020 if nothing is plugged in.
    If no light sensor is plugged into port 2, but a light sensor is plugged into port 3, then the value is read out when port # = 2 (!?)
    • changed sensor
    • changed cable
    • unplugged
    • turned Lego on and off
    Touch - Works, but how do you tell if  its just bumped?
    Motor.basic - motor does not seem to halt or turn off as expected
    Buttons: How can we detce multiple buttons as inputs. Only 1 is returned at at time.

    Working:  
    Testcases under: LegoHW
    Buttons: 2 1 4     each button is a bit.

                         8

    Touch 0 = out; 1023=pushed;

    Shutdown FB  (test appl(s):  TurnOff)
        No outputs since can't return something after power is off,
        however Forte export filter does not generate one 0 to indicate no outputs.  (fix coming)
       Works with hand change.

    Motors A-C work as output ports 0-2 










    ltSensor.led ports 1-4  (test appl(s):  blinky1; OffLed2)
      FORTE changes needed for PORT init needed have been checked in (so shouldn't reoccur)









    ltsensor.rd FB ports 1-4 (test appl(s):  RdLight, OffLed2)
    The lms AVR functions from Alex are in c since added on to eCos
    but Forte generates C++ code so following was needed:
    #ifdef __cplusplus
    extern "C" {
    #endif

    function headers
    #ifdef __cplusplus
    }
    #endif



    Sensor Ports and led = flood light
    port 4 needed additional initialization for avr  since its a rs 485 port
    how lejos initializes ports

    Wednesday, April 7, 2010

    Apr.7 Can work!

    Bad JTAG to Lego cable replaced so can test on Lego HW !!
    Working on using PORT as input:
    Test works, but gets error message.
    Reason: INT was commented out in code to save space 
    256Mb Flash is small so need to keep FORTE small so room for applications
    see eclipseWork\forte_lms_neu\src\Makefile.am 
    ex:
    forte_SOURCES += core/datatypes/forte_uint.cpp
    #forte_SOURCES += core/datatypes/forte_usint.cpp

                 


    Debugging (stepwise) simple line1b algorithm via simulation
    • learned new tricks about testing with FBDK FBs for UI.
      • composite  FB includes 
        • Java imports entered via click on compiler (import fb.rt.hmi.*;)
        • when save the package name is added to this information
      • 4DIAC xmls and FBDK java/class files
        • open 4DIAC xmls in the workspace/system/typelibrary group
        • saved under FBDK src/package_name directory
      • FBDK FBs for UI.
        • FBs can be tested under FBDK without an application!
        • if INIT event path comes back to the REQ of an FBDK FB and the event is sent to the REQ, but no CNF sent, then add an E_DELAY with small time between the send and the REQ input. (=FBDK error workaround)

    *FBDK FBs in 4DIAC-IDE/FORTE

    HInts how to use FBDK in combination with 4DIAC.
    (under construction)


    From Mar.3 post
    1. 4DIAC: Develop Application and FB Types
    2. FBDK editor parse: Check for basic and composite FB errors    
      (no Structured Text error checks currently in 4DIAC?)
    3. FBDK editor save as: 
      • Converts the updated XML to Java class (fb.rt.fbTypeGroupName)
      • Compiles to Java classes in FBDK
    4. 4DIAC: Add fbTypeGroupName to FBRT preferences
    5. 4DIAC: Add new FBs where needed in application
    6. 4DIAC: Test via Deployment of FBRT in 4DIAC
    Can test FBs in FBDK without an application!

    Symptom: Event is sent, but the FB doesn't react to the event:
    Reason:   (in FBDK) Certain feedback requests (INIT connections come back to the REQ)need Solution:  an E_DELAY before the REQ.

    Friday, April 2, 2010

    Apr. 2 LMS openocd-flash screenshots/problems

    If JTAG quits, then
    • turn off LMS (switch or take battery out)
    • unplug usb to JTAG and plug back in
    • wait for JTAG to boot (blinking light)
    • turn LMS back on

    Looking for a pattern on when
    • VLOW and 
      • looks like problem was broken wires in the connector from the JTAG
      • also if the lms is plugged in then FORTE is running, which may use more power than what is coming from charger 
        • (so need to look into power management later)
    • broken pipe problems 
      • unknown eclipse problem - but did occur with arm-elf-insight was running
    occur:
    • to avoid these problems
    • to find the simplest or at least some consist way to get LMS openocd-flash to work again
    Don't yet have a full set of fully working screen shots, nor screenshots as soon as problems start.
     
     LMS openocd-flash screenshots
     with no problems: (from 2 Apr.)











    openocd.bat with no errors











    java eclipse - run also worked correctly (no screenshot)
    Mistake: in 4diac-ide / deployment clicked on launch forte instead of download

    unfortantely didn't take screenshot first time Vlow problem occurred
    with Vlow problem (from 2 Apr. - plugged in, 2nd time)
    Webpage partly shown: http://powerelectronics.com/news/converter-controller-ics-0428/

    LMS continually clicks, showing it is firmware reset mode  
    • openocd-flash.bat downloads to firmware, it must hang / have problems after going into firmware reset mode. 
    • The clicking eventually stopped, but not clear why.
      • Tried reseting the firmware for an LMS with LEGO default Mindstorms firmware. It continued to click until its firmware was updated (via LEGO Mindstorms SW).
    • LMS when turning PC on and off
      • Turn computer off and LMS stays on
      • Turn computer on
        • LMS turns off at some point when the user id is being signed on to (not during boot up)
      • PC on / Press orange button
        • led turns on
        • lms starts to click and PC sounds like a device was connected
        • after some time: 
          • PC sounds: device disconnect
          • LMS clicking stops, 
          • led turns off 
    • Tried updating firmware from LEGO Mindstorms
      • The NXT brick was not found
        • either device not recognized by PC
        • or what is currently on the NXT brick makes unrecognizable
    Vlow value:
    • 1.47-1.55 with USB plugged in to the LMS
      • same value with or without the battery pack in the LMS!
    • 0 when USB is not plugged in to LMS
    • JTAG error if its USB is not plugged in
    • 3.2 but then get -902 error, next time back to Vlow error














    -902 error (battery plugged in and fully charged)
    Also the PC:
    • pops up a unrecognized device connected message; 
    • device connection sound; 
    • shortly afterwards device disconnect sound
    Beforehand arm-elf-insight  followed by open of forte.exe worked.




    Thursday, April 1, 2010

    Apr.1 Line Follower with 1 Light Sensor


    Line Follower with 1 Light Sensor
    No findLine yet, so only follows curves in 1 direction.
    Tests: basic design set-up, LightSensor, 2 Motors, and simple turn.
    Start: SetRdState.R
    • calibrate on line
    • calibrate off line
    • if black both motors fwd                        else 1 motor fwd