Thursday, April 29, 2010

Apr.29 Buttons clean-up

Buttons: 2 1 4     each button is a bit.

                     8

Pressing 2 Buttons
  • Our eCos/lms only supports pressing 1 button.
  • and the raw button value is not available to user.
  • Usually button 1 = enter (orange) + another button is supported.
Changes needed:
  • eCos avr_cntl add function to return the raw button value
    • will allow a user to add support for 2 buttons pressed via a FB as an exercise
  • add OR of states and test values for at least Button 1+ another button

Wednesday, April 28, 2010

Apr.28 CalibrateBnd Basic FB Tests on Brick

 Online Test used on LMS brick (in test) 
Note: Starting with led off means the first sample is darker than the rest and should not be used.  cnt1 is now initialized to 0 and the 1st data sample is not added in.













Basic Test used on LMS brick. 
Note: leds 2 & 3 turned off since default state currently is on.  Delays help see results. GDB Debugger was not used/ necessary.

*Apr. 28+ Port Manager FB

A mechanism is needed to avoid:
  • multiple sensors types used on the same port
  • to encourage application developers to only use 1 FB for 1 physical sensor / motor.
Related notes will collected here and formatted as the ideas become better formulated.

Open Questions:
  • Can Port assignment / use be required / enforced using FBs?
Simple Mgr can check if the port is taken and reserve the port#,  but no check if its used.
  • Should input ports (sensors) &output ports (motors) be managed together or separate?
In other words should there be an Lego Brick FB or 2 port managers? Leaning toward 2 port managers at the moment.
  • Port / sensor Initialization at start-up or when first used?
If the leds are initialized when the AVR is, then no need when the led FB is used.
Extra work to initialize all 4 leds even if they are not used.

Or should initialization be moved into FBs or allowed as an option?

Sunday, April 25, 2010

* Apr. 26 Firmware Flashing - general

Lego Mindstorms 
  •  Update to latest Lego Mindstorms firmware
    • start Lego Mindstorms SW
    • open NXT window 
    • update firmware
  • to restore Lego Mindstorms firmware
    • connect the NXT to the PC 
    • start Lego Mindstorms SW
    • open NXT window 
      • The NXT brick should be available
    • push the reset button with a paper clip 
    • in Mindstorms SW do a firmware update
    • NOTE: If reset and then go into Mindstorms SW brick will not be available.
Lejos
  • connect NXT to PC
  • upload the firmware via eclipse lejos button (top) or via cmd line
eCos + Forte   
Normal mode coming this week....
currently only debug options
see Apr.19 Samba mode Firmware flashing

Thursday, April 22, 2010

Apr.22 Light Sensor Clean-up

Open 4/29 
clean-up: right place for led initialization + no unnecessary duplicate code
Options: 
  • during eCos/Forte boot *(now led 1 only)
  • avr initialization *(now turn all 4 off)
  • led function block initialization *(now reinitialize)


led
Hiding the following in  inline functions and static const s
  • led initialization, 
  • port 4 initialization 
  • led on/off -  now 0 is off and 1 is on. Inverted logic was used before.
rd
Testing:
read correctly from all light ports
Port 3 Funnines was caused by design funny:
  • for led used 1 for index of first port into an array with HW pins to match standard port #s
  • for rd light sensor used this index for port #, but it was +1
Design change: led to HW array to starts with 0 and use (PORT-1) now for led and rd
Comment: led and rd are in same sensor, but different Fn Blocks in FORTE
    SW-wise first thoughts are 1 Object so 1 function block
    but HW-experts prefer separate, since functions are different.
    Different fn blocks allow differences, but easier to understand if same
    Led was hard-coded to 1 port and then later generalized - (how this really happened)

(debugging port 3 funnies described in  Apr.8- 16+ Checking out LMS HW from FORTE)

1020+ indicated nothing is plugged into a port

initialization - Both Lego & Lejos initialize all leds to off


By default  when lms is turned on leds 1-3 is on and led 4 is off.
Changed so RS485 port is initialized and all 4 leds are turned off during avr state e_INITIALIZED:
* This still may not yet be the best place /cleanest code solution. In default mode leds 1-3 had to be in the applications to turn them off even if they were not used. Extra unnecessary FBs to initialized changed the logical INIT event flow and cluttered how the application looked (was annoying and now fixed).

4/26
Trace notes:
 rd.cpp FORTE_rd::executeEvent (REQ)
             ltVal= GetSensorState(PORT);
avr_ctl.c GetSensorState(cyg_uint32 pa_nInputPort)
watch variable:  io_from_avr->adc_value



Monday, April 19, 2010

Apr.19 Samba mode Firmware flashing

Currently the firmware is flashed with eCos and Forte FBs via JTAG. (so unplug JTAG USB cable)
Samba mode via sam-ba v2.9 flashes the firmware via USB like Lego Mindstorms and Lejos upload does.

1. Press the reset button with the end of a paper clip. Since the display is not yet working with Forte,  we 
  • take out the battery, 
  • press the reset button, 
  • put the battery back in, 
  • press orange power button.
2. When hear the device is connected to the PC, click on the device symbol.
The message shown in the picture below should appear. 
(or at least hear a device was connected to PC)






3. Open Sam-ba and connect
(Important: that it says \usb\ARM0 and at91sam7s256-ek indicating its the Lego MS that it wants to connect)









Sam-ba flash page appears
4. In Send File select the most recent forte.bin and press the Send File button


  • unlock yes
  • lock no
  • (close window)
5.  Power off / on so forte boots (see with blinking led in PORT 1)

Ready to test / work again

Sunday, April 18, 2010

Apr.18 CalibrateBnd Basic FB Tested (simulation)

Calibrating average color and boundary between colors was tried previously as a composite FB ( Mar.23 Calibrate as Composite FB + FindLine)  This version was hard to test via simulation using FBDK due to extra delays needed for output.

The following is a Basic FB version of calibration and has been tested using FBDK.

The FB reads N samples on-the-line, then N samples off-the-line. The steps are: 

  • led on (light sensor positioned over line)
  • on-the-line read N samples
  • led off (move so light sensor positioned off the line)
  • [delay will go here]
  • led on (light sensor positioned off the line)
  • on-the-line read N samples
  • calculate average boundary between on and off the line

Interface 

 

 

 

 

Execution Control Chart (ECC)