Shop OBEX P1 Docs P2 Docs Learn Events
Serial Data 'pass-through' - Page 2 — Parallax Forums

Serial Data 'pass-through'

2»

Comments

  • shanghai_foolshanghai_fool Posts: 149
    edited 2008-11-26 10:43
    OK, after several hours, I finally have the demo working. The major problem was _READSEL.
    It does not work as I thought. The working file is attached. You can use the previous FPU.spin.

    Now I can go forward with more comfort.

    Cheers,

    Donald
  • Jim PatekJim Patek Posts: 15
    edited 2008-11-26 19:02
    GREAT! Congrats

    It also works with the "ReadSTR" command in the FPU driver.

    [color=#000099] 
        strPtr := FPU.ReadStr
        dbg.str(strPtr)
    [/color]
    



    Have you tried the FPU IDE to upload functions yet? It works, but seems to shift the FPU out of DEBUG
    mode after every command. Cycling the power to the chip institutes a RESET and it will accept another
    command. I have loaded the functions from the "Distance" example but, for some reason, it makes my
    program stop working. I think the functioins are trying to use the same registers that I am, so I will try
    using others. I'll let you know what happens.

    Jim
  • shanghai_foolshanghai_fool Posts: 149
    edited 2008-11-26 19:36
    Jim,
    Yes, I have loaded the functions and am working on converting the GC Demo. I have it working but my stack is not right. There is an extra call somewhere and its late (3:30AM) and I think I'm going blind.
    Great Circle Distances
    FPU MASTER CLEAR...
    FPU Driver started...----uM-FPU-V3.1 demo with SPI---
    FPU Software Reset done...
    Response to _SYNC: 92 (OK)
     Version String: uM-FPU V3.1.0
     Clock ticks / ms: 29480
    From:
     Reading GPS ...
     Location (31deg 14min, 121deg 30min)
    To:
     London, England (51deg 32min, 0deg 5min)
       4960.96 nautical miles
       3082.60 miles
       4960.96 kilometers
     Paris, France (48deg 49min, 2deg 20min)
       5001.65 nautical miles
       3107.88 miles
       5001.65 kilometers
     Sydney, Australia (-34deg 1min, 151deg 0min)
       4254.49 nautical miles
       2643.62 miles
       4254.49 kilometers
     Tokyo, Japan (35deg 41min, 139deg 45min)
        950.35 nautical miles
        590.52 miles
        950.35 kilometers
     Zurich, Switzerland (47deg 22min, 8deg 31min)
       4864.50 nautical miles
       3022.66 miles
       4864.50 kilometers
     New York, USA (40deg 47min, -73deg 58min)
       6395.03 nautical miles
       3973.69 miles
       6395.03 kilometers
     Los Angeles, USA (34deg 4min, -118deg 15min)
       5629.53 nautical miles
       3498.03 miles
       5629.53 kilometers
     Santiago, Chile (-33deg 29min, -70deg 45min)
      10165.39 nautical miles
       6316.48 miles
      10165.39 kilometers
    
    
  • shanghai_foolshanghai_fool Posts: 149
    edited 2008-11-26 20:41
    Jim Patek said...
    GREAT! Congrats

    It also works with the "ReadSTR" command in the FPU driver.

    [color=#000099] 
        strPtr := FPU.ReadStr
        dbg.str(strPtr)
    [/color]
    


    Jim, I know it is supposed to work that way but that is what is causing me problems now in this one.
    If I disable everything from just before the call, the program terminates correctly.
    But if i just insert
    dbg.str(FPU.ReadStr)
    the programs goes haywire and does not exit. Sometimes it starts printing correctly but it always goes out to lunch before completing. Now I can't remember how I got it to work before.

    ·
  • shanghai_foolshanghai_fool Posts: 149
    edited 2008-11-27 01:17
    Here are the results but I stilll can't find the problem.
    The main program calls FP_Demo, whichs runs correctly but does not return to the main program wich closes the cogs.
    Maybe someone else can spot my error. My eyes are bleary. Files attached.
    uM-FPU V3.1 demo with SPI protocol
    FPU MASTER CLEAR...
    FPU Driver started...FPU Software Reset done...
    Response to _SYNC: 92 (OK)
     Version String: uM-FPU V3.1.0
     Clock ticks / ms: 29480
    From:
     Reading GPS ...
     Location (31deg 14min, 121deg 30min)
    To:
     0:London, England (51deg 32min, 0deg 5min)
       4960.97 nautical miles
       3082.60 miles
       4960.97 kilometers
     1:Paris, France (48deg 49min, 2deg 20min)
       5001.65 nautical miles
       3107.88 miles
       5001.65 kilometers
     2:Sydney, Australia (-34deg 1min, 151deg 0min)
       4254.48 nautical miles
       2643.61 miles
       4254.48 kilometers
     3:Tokyo, Japan (35deg 41min, 139deg 45min)
        950.36 nautical miles
        590.53 miles
        950.36 kilometers
     4:Zurich, Switzerland (47deg 22min, 8deg 31min)
       4864.50 nautical miles
       3022.66 miles
       4864.50 kilometers
     5:New York, USA (40deg 47min, -73deg 58min)
       6395.04 nautical miles
       3973.70 miles
       6395.04 kilometers
     6:Los Angeles, USA (34deg 4min, -118deg 15min)
       5629.54 nautical miles
       3498.03 miles
       5629.54 kilometers
     7:Santiago, Chile (-33deg 29min, -70deg 45min)
      10165.39 nautical miles
       6316.48 miles
      10165.39 kilometers
    GC Demo Finished
    
    



    Donald
  • shanghai_foolshanghai_fool Posts: 149
    edited 2008-11-27 01:25
    The next item on my agenda is to be able to program functions from within the spin program.
  • shanghai_foolshanghai_fool Posts: 149
    edited 2008-11-27 02:30
    I see the nautical miles calculation is incorrect. It is same as km.
  • shanghai_foolshanghai_fool Posts: 149
    edited 2008-11-27 03:26
    Found the distance problem. It is around line 689. I did not know what they were trying to do.
    It is supposed to be writing a floating point number. Here is the corrected portion:
            dbg.str(string (13, " "))
            FPU.WriteCmdByte(_SELECTA, dist_km)
            FPU.WriteCmdByte(_FSET, dist_nm)
            FPU.WriteCmd(_FWRITE0)             
            FPU.WriteCmd3Bytes($3F, $ED, $0E, $56) 'Float 1.852
            FPU.WriteCmd(_FMUL0)
            FPU.WriteCmdByte(_SELECTA, dist_miles)
            FPU.WriteCmdByte(_FSET, dist_km)
            FPU.WriteCmdByte(_FCNV, 13)
            format := 92
            print_FloatFormat
            dbg.str(string (" miles"))
    
    

    I still have not found the stack problem but I know it is the
    dbg.Str(FPU.ReadStr) (Line 656)
    If I put a return before this statement, it returns correctly. If I place a return after the statement, it does not. ?????
    ·
  • shanghai_foolshanghai_fool Posts: 149
    edited 2008-11-27 04:49
    BTW, the GPS_Demo2.spin is working at 57600 baud. 5 Hz. GPS.
Sign In or Register to comment.