Shop OBEX P1 Docs P2 Docs Learn Events
Propeller JVM Project: PASM Java VM - Page 7 — Parallax Forums

Propeller JVM Project: PASM Java VM

1457910

Comments

  • jmspaggijmspaggi Posts: 629
    edited 2010-05-03 02:02
    Ok.

    I just figured it's comming from my initilisation blocks which was not included above.

            for (int i = 0; i < PROP.pins.length - 1; i++)
            {
                PROP.setOutput(PROP.pins[i]);
                PROP.writePin(PROP.pins[i], false);
            }        
            PROP.setInput(PROP.pin23);
            PROP.setInput(PROP.pin24);
            PROP.setInput(PROP.pin25);
            PROP.setInput(PROP.pin26);
    [/i][/i]
    



    Can you please test attached code?

    In loop 1, it's working, in loop 2, it's not working anymore.

    The for loop is initialisation pin0 to pin30 so it should not impact pin31. I tried with -2 instead of -1 with the same result. But if I comment the for loop, then it's working fine...

    Any clue?

    JM
  • jazzedjazzed Posts: 11,803
    edited 2010-05-03 02:29
    Ok, it works fine except for an exception at the end which is fixed by having "while(true);" added to the end of main.
    Added: If I'm not mistaken, your for loop sets pins 0 to 30 to output with 0 on outputs. Total pins length is 32. If you write pin30 high instead, you would see no output after the loop.
    Cheers.
    --Steve

    attachment.php?attachmentid=69992

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.

    Post Edited (jazzed) : 5/3/2010 2:50:21 AM GMT
    818 x 562 - 73K
  • heaterheater Posts: 3,370
    edited 2010-05-03 13:21
    Jazzed: "So now the 1 COG code is actually faster at under 5.8s for FIBO(24)."

    Interesting. Following my failed multi-prop Z80 attempt and I believe a multi-prop 6502 attempt elsewhere the Javelin must be the third of fourth VM/emulator project to arrive at this same result.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-03 13:37
    jazzed said...
    Ok, it works fine except
    [noparse]:([/noparse] Sorry was my mistake [noparse]:([/noparse] I had a wire between pin 26 and pin 31. So when I was configuring pin26, this was affecting Pin31 and not working anymore.

    I removed the damned wire, and it's now working fine.

    Regarding the speed, I want to say that it's faster and reducing the blinking, but it's difficult to mesure. So I will rely on your results [noparse];)[/noparse]

    So far, my 2 projects for my props are:
    - fully-configurable LED Digits driver (in Java, Spin and if I can PASM)
    - A javelin 30 I/O extender. (Java, and again, Spin and PASM if I can)

    Also, I will rebuild my test suite with the DS1302, the LCD screen, the LCD Digits, Fibo, and some other stuff to do some testing.

    @heater: Are you saying that since the JVM is running on one single COG, it will be able to have a multi-prop JVM to increase the spead?

    JM

    Message Edité (jmspaggi) : 5/3/2010 2:25:58 PM GMT
  • heaterheater Posts: 3,370
    edited 2010-05-03 14:17
    @jmspaggi: No.

    I'm just making the observation that there have now been a number of attempts to implement emulations/virtual machines using multiple COGs.
    In each case the reason for using multiple COGs was simply that a single COG does not have the space to get all the raw PASM code in. Not necessarily to get speed.
    In each case it has turned out quicker to use some other technique to get the code into a single COG than to spread the code over many COGS.
    So for example using overlays or LMM to get more code into one COG is quicker than spreading that same code over two COGs.

    Please, excuse any mis-statements about Javelin I may be making now, I have not looked into the code. Does it use LMM? Does it use overlays?

    Seems that the overheads of sharing state information and synchronizing COGS is greater that using overlays or LMM in general. This is a somewhat surprising result and points to the idea that the Prop needs more help in inter-COG communications.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-03 15:02
    Ok I see. And I agree. Will be nice to have a way to share data between cogs whitout going to the hub... Maybe for Prop2? [noparse];)[/noparse] I don't think we need a big memory area for that, but at least, we need some...

    Regarding the Javelin architecture, I'm don't know. Peter is the expert and might be able to resply to that question...

    JM
  • jazzedjazzed Posts: 11,803
    edited 2010-05-03 15:49
    @JM,

    I'm so glad you have a working Serial Loopback configuration now.
    Did you happen to try your SerialLCD with the Java library I provided?
    I've attached a demo that should have much better timer performance.

    @heater,

    The JVM uses overlay to fetch the byte code implementation routines.
    I decided against LMM in this case because 1) the number of instructions
    to load is deterministic, 2) LMM kernel services take up precious COG
    space, and 3) LMM jumps are clumsy. There are many COG stubs that
    overlay routines use to speed up operations such as push/pop etc....

    For the overlay loader, I chose not to use the decrementing load mainly
    because it is a PITA to configure and use. The solution I'm using now
    has a very short instruction decode and load setup. Most byte codes are
    implemented in less than 5 instructions with in-COG helper routines, so
    I use the unrolled fetch method to grab 4 instructions at a time before
    missing a hub window. The one disadvantage of my implementation is
    that NOP in the overlay code must be non-zero since I use 0 to terminate
    the load; however, this allows for not keeping a length table.

    One performance enhancement between the current JVM COG and the
    last ones is that the JVM actively reads byte codes rather than "spinning"
    for another COG to send a byte-code as done in a multi-COG design.
    This also lets the core solution (without VP, etc...) use only 2 COGs.

    Surprisingly, the JVM footprint is small enough to allow 19KB user code.
    This could have never been achieved using LMM C.

    Cheers.
    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-03 17:28
    @Steve:

    Things are working pretty well!

    Starting MultiSegmentDisplayDriver test...
    MultiSegmentDisplayDriver.init v1.7
    ?MultiSegmentDisplayDriver v1.7
    SerialLCDTest.java v2.3
    Waiting 2 second...
    ... Done
    Starting LCD test...
    Starting UART
    Sending content
    Stopping UART
    End...
    Waiting 2 second...
    ... Done
    Starting ScaledTimer test...
    0 1816 ticks. 1012 ms. tock
    1 1815 ticks. 1012 ms. tick
    2 1816 ticks. 1012 ms. tock
    3 1810 ticks. 1009 ms. tick
    4 1816 ticks. 1012 ms. tock
    .
    .
    .
    117 1815 ticks. 1012 ms. tick
    118 1813 ticks. 1010 ms. tock
    119 1817 ticks. 1012 ms. tick
    End...
    Starting Fibo test...
    FIBO(00) =     1 (    3 ms)
    FIBO(01) =     1 (    3 ms)
    FIBO(02) =     1 (    3 ms)
    FIBO(03) =     2 (    3 ms)
    FIBO(04) =     3 (    4 ms)
    FIBO(05) =     5 (    4 ms)
    FIBO(06) =     8 (    4 ms)
    FIBO(07) =    13 (    5 ms)
    FIBO(08) =    21 (    6 ms)
    FIBO(09) =    34 (    8 ms)
    FIBO(10) =    55 (   10 ms)
    FIBO(11) =    89 (   14 ms)
    FIBO(12) =   144 (   21 ms)
    FIBO(13) =   233 (   32 ms)
    FIBO(14) =   377 (   50 ms)
    FIBO(15) =   610 (   79 ms)
    FIBO(16) =   987 (  126 ms)
    FIBO(17) =  1597 (  202 ms)
    FIBO(18) =  2584 (  324 ms)
    FIBO(19) =  4181 (  523 ms)
    FIBO(20) =  6765 (  844 ms)
    FIBO(21) = 10946 ( 1364 ms)
    FIBO(22) = 17711 ( 2204 ms)
    FIBO(23) = 28657 ( 3565 ms)
    FIBO(24) = 46368 ( 5766 ms)
    End...
    Starting DS1302 test...
    00:00:00 6059 ms.
    00:00:00 987 ms.
    00:00:00 987 ms.
    00:00:00 988 ms.
    00:00:00 988 ms.
    00:00:00 985 ms.
    00:00:00 987 ms.
    00:00:00 987 ms.
    00:00:00 987 ms.
    00:00:00 985 ms.
    End...
    Starting MultiSegmentDisplayDriver test...
    MultiSegmentDisplayDriver.init v1.7
    ?qq?ww?ee?rr?tt?yy?uu?ii?oo?pp?   
    
    



    LCD screen is now working perfectly. I have "12345678901234567890" displayed, and no other extra char.
    DS1302 is no more working. I will look at the wiring first [noparse];)[/noparse]
    Also, the Uart loopback is working, but I have an extra char that I'm not expecting.
    The tick/tock is working fine, but sometime I receive 500ms instead of 1000ms.

    I will try to add the DS1620 today to see.

    Thanks,

    JM
  • jazzedjazzed Posts: 11,803
    edited 2010-05-03 18:36
    @JM,

    Well, that's a great relief! [noparse]:)[/noparse]
    Looks like I don't have to spend $40 now on a SerialLCD I won't use.

    The timer thing is a big PITA!
    Like I said, it should work better but it's not perfect. The math for
    CPU.carry in Timer.java works otherwise other math stuff like
    divide_u32_u16 and others would fail. I'm experimenting with timer
    values now to see if there is something I don't expect happening.

    Don't know what to suggest about those extra characters except
    that all main()'s should end with a "while(true);" loop. Funny how
    the output looks kind of like a keyboard line ... qwertyuiop

    I'll retest some DS1302 code on my PPDB today.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jazzedjazzed Posts: 11,803
    edited 2010-05-03 18:44
    Well, I had the same 0:0:0 problem with the DS1302 on the PPDB
    until I added "ds1302.halt(false);" after instantiating a new object.

    Works fine now except that initial 0:0:0 the JVM probably not causing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jazzedjazzed Posts: 11,803
    edited 2010-05-03 19:57
    Ok @JM, I got it.
    The timer calculation is bad if pnative.nm_core_Timer_latch lower word is $0000.
    To prevent this, one fix is to add increment latchCount after getting it and before the writeVpRegister calls:

    PUB nm_core_Timer_latch(bank) | latchedCount
      '/**
      ' * Latch the 32bit counter into the latch registers.
      ' * Called by Timer.tickLo()
      ' *
      ' * @param bank The allocated area for the Timer registers.
      ' */
      latchedCount := vp.ReadTimer(getDev(bank))
    
      ifnot (latchedCount & $ffff) ' if lower word of latchedCount is 0, increment it
        latchedCount++
    
      writeVPregister(bank + def#nmLatchTimer1, (latchedCount >>  0) & $ff)
      writeVPregister(bank + def#nmLatchTimer2, (latchedCount >>  8) & $ff)
      writeVPregister(bank + def#nmLatchTimer3, (latchedCount >> 16) & $ff)
      writeVPregister(bank + def#nmLatchTimer4, (latchedCount >> 24) & $ff)
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-03 20:23
    I just saved you $40, so can you send me $20? [noparse];)[/noparse]

    The ds1302 is also working for me with the halt call.

    Also, I don't know where this qwertyuiop is coming from [noparse];)[/noparse]

    What's the next thing you will work on? Will it be the JNI option? Might be usefull. Because I will be happy to have a dedicated cog to run my main loop. It's VERY small, just 5 lines in Java.

    I just implemented the fix in pnative. It's running since 2000 seconds. I will let it run for another 20000. I will let you know the result.

    Thanks,

    JM

    Message Edité (jmspaggi) : 5/3/2010 9:17:19 PM GMT
  • jazzedjazzed Posts: 11,803
    edited 2010-05-03 21:28
    @JM, I'll find a non-currency method of paying you back [noparse]:)[/noparse]
    jmspaggi said...

    What's the next thing you will work on? Will it be the JNI option? Might be usefull. Because I will be happy to have a dedicated cog to run my main loop. It's VERY small, just 5 lines in Java.
    JNI is in the near future. JNI provides an interface to methods written in the CPU's Native language ... Spin/PASM in this case. JNI is important based on the kinds of peripherals I'm used to having on Propeller so it's a high priority item. Any JNI beyond the current set should be pluggable and not part of the standard Javelin code base.

    I'm thinking to update the top post package first. Does the current directory structure suit you? There is another alternative where we can put the JVM code in the same directory as JavaBuild and that might be easier to maintain and use for new users.

    I also want to turn garbage collection GC back on. Last I checked it was broken. GC can periodically get in the way of Java performance but not VPs or other code running in non-java COGs. Without GC, memory can be a bigger issue in this 19KB user byte-code JVM. There is some debugging that would have been impossible without it for example.

    One thing worth doing is building the Javelin BOE-BOT. That would be a good hardware interface test.

    I won't have much time the rest of the week, but will get back in it next hard and heavy week.
    jmspaggi said...

    Regarding the timing fix, in which file should I update that?
    That goes in pnative.spin ... just add the missing lines to the method (CTRL-F to search method name).

    Cheers.
    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-03 22:03
    jazzed said...

    JNI is in the near future. JNI provides an interface to methods written in the CPU's Native language ... Spin/PASM in this case. JNI is important based on the kinds of peripherals I'm used to having on Propeller so it's a high priority item. Any JNI beyond the current set should be pluggable and not part of the standard Javelin code base.

    Yep, I'm fine with that. I will build my own Spin or PASM object and try to interface it with the Java code though JNI when this will be available.
    jazzed said...

    I'm thinking to update the top post package first. Does the current directory structure suit you? There is another alternative where we can put the JVM code in the same directory as JavaBuild and that might be easier to maintain and use for new users.

    I have not really test the packaging itself since I'm using my own build script and so on. I will try to start back from scratch and see how it's going with the last packages I have.
    jazzed said...

    I also want to turn garbage collection GC back on. Last I checked it was broken. GC can periodically get in the way of Java performance but not VPs or other code running in non-java COGs. Without GC, memory can be a bigger issue in this 19KB user byte-code JVM. There is some debugging that would have been impossible without it for example.

    I prefer whitout the GC. I'm managing the memory carrefully everywhere, so a GC wil just weast few cycles. BUT... If we can activate/de-activate it with IFDEF, then it will be perfect.

    Just le me know if you activate it, and I will test it actively.
    jazzed said...

    I won't have much time the rest of the week, but will get back in it next hard and heavy week.

    That will give me some time to help on pPropellerSim and to learn Spin.
    jazzed said...
    That goes in pnative.spin ... just add the missing lines to the method (CTRL-F to search method name).
    I found it and tried it. So far it's running for 4600 secs now with no issue. I will keep it running, maybe all night long, and report the result.

    Thanks,

    JM
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-04 10:39
    Something went wrong over the night for the tick/tock... Good luck. I will keep it running and let you know. I already got the issue yesterday evening and tought it was because I touched something (wire, etc.). So I re-ran it. And got the same issue this morning.

    JM

    17606 1814 ticks. 1011 ms. tick0 error(s).
    17607 1814 ticks. 1011 ms. tock0 error(s).
    17608 1811 ticks. 1009 ms. tick0 error(s).
    17609 18 ticks. 13 ms. tock1 error(s).
    17610 18 ticks. 13 ms. tick2 error(s).
    17611 18 ticks. 13 ms. tock3 error(s).
    17612 18 ticks. 13 ms. tick4 error(s).
    17613 18 ticks. 13 ms. tock5 error(s).
    17614 18 ticks. 13 ms. tick6 error(s).
    17615 18 ticks. 13 ms. tock7 error(s).
    17616 18 ticks. 13 ms. tick8 error(s).
    17617 18 ticks. 13 ms. tock9 error(s).
    17618 18 ticks. 13 ms. tick10 error(s).
    17619 18 ticks. 13 ms. tock11 error(s).
    17620 1811 ticks. 1009 ms. tick11 error(s).
    17621 1813 ticks. 1010 ms. tock11 error(s).
    
    




            System.out.println ("\nStarting ScaledTimer test...");
            boolean tick = false;
            int i = 0;
            int errors = 0;
            while (!rx.byteAvailable())
            {
                i++;
                scaledTimer.mark();
                for (clock.mark(); !clock.timeout(1000););
                int ticks = scaledTimer.passedTicks();
                int time = scaledTimer.passedTime();
                
                System.out.print(i);
                System.out.print(" ");
                System.out.print(ticks);
                System.out.print(" ticks. ");
                System.out.print(time);
                System.out.print(" ms. ");
                System.out.print(tick?"tick":"tock");
                if (time < 1000)
                    errors++;
                System.out.print(errors);
                System.out.println(" error(s).");
                tick=!tick;
            } // end for
            System.out.println ("End...");
    
    
  • jazzedjazzed Posts: 11,803
    edited 2010-05-04 14:34
    jmspaggi said...
    Something went wrong over the night for the tick/tock... Good luck.
    Bummer.

    These are the worst kinds of problems to debug.
    Did both failures happen around the same count 17610 ?

    I ran a test to see what would happen when the 32 bit counter
    wrapped from FFFFFFFF back to 0. That worked fine.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-04 14:40
    Yep, I agree. Kind of defect we don't like to troubleshot...

    I tried up to -24400 with no other issue. I just restarted it. I will let you know in 17610 seconds [noparse];)[/noparse] Which is about 5h.

    Since yesterday I'm loging all propeller outputs in a file, so I can also go back and see the past results.

    JM
  • jazzedjazzed Posts: 11,803
    edited 2010-05-04 15:52
    jmspaggi said...
    Yep, I agree. Kind of defect we don't like to troubleshot...

    I tried up to -24400 with no other issue. I just restarted it. I will let you know in 17610 seconds [noparse];)[/noparse] Which is about 5h.

    Since yesterday I'm loging all propeller outputs in a file, so I can also go back and see the past results.

    JM
    Logging (script or stdout piping) is a wonderful advantage of unix/linux [noparse]:)[/noparse]

    Ah, so the counter wrapped. I'm not sure if it is significant though.
    I stopped my test after the wrap.

    Could you do me a favor and restart with the following timer latch method?
    It will print 3 to 4 counter lines between tick-tocks.

    PUB nm_core_Timer_latch(bank) | latchedCount
      '/**
      ' * Latch the 32bit counter into the latch registers.
      ' * Called by Timer.tickLo()
      ' *
      ' * @param bank The allocated area for the Timer registers.
      ' */
      latchedCount := vp.ReadTimer(getDev(bank))
    
      if (savedCount & $ffff_8000) <> (latchedCount & $ffff_8000)
        sio.hex(latchedCount,8)
        sio.tx(" ")
        sio.hex(savedCount,8)
        sio.tx(" ")
        sio.str(string("diff = "))
        sio.dec(latchedCount-savedCount)
        sio.tx($d)
    
      savedCount := latchedCount
    
      ifnot (latchedCount & $ffff)
        latchedCount++
    
      writeVPregister(bank + def#nmLatchTimer1, (latchedCount >>  0) & $ff)
      writeVPregister(bank + def#nmLatchTimer2, (latchedCount >>  8) & $ff)
      writeVPregister(bank + def#nmLatchTimer3, (latchedCount >> 16) & $ff)
      writeVPregister(bank + def#nmLatchTimer4, (latchedCount >> 24) & $ff)
    
    var long savedCount
    
    



    BTW, I verified the Spin based GC works with some modifications and
    it is enclosed with #ifdef GCOLLECT. I don't have any room for GC in
    the JVM COG. Guess I'll have to use a different data-structure for heap
    to improve performance ... the "heap" structure gives O(log N) searching.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-04 16:45
    Hi Steve,

    Test is running.

    I will post the result in 5h.

    Regarding the GC, maybe we can dedicate a COG for those who want to have it?

    JM
  • ChimChim Posts: 16
    edited 2010-05-04 17:04
    Hi,

    @jmspaggi : I think that is a good idea !

    @jazzed : As soon as BST works on my computer, I would confirm the file I2C.java.

    Is it possible to implement a variable long type too ?

    Marco.
  • jazzedjazzed Posts: 11,803
    edited 2010-05-04 18:23
    @Chime`re,

    I plan sometime to implement the Java2 VM. That will have long data type.

    The Javelin "standard" does not use longs. I want to the current VM to run all the legacy Javelin code.
    I very much appreciate your help in verifying compatibility with the Javelin by testing I2C.java.

    Agreed, the GC is better done in a separate PASM COG. Since I already have that code, it will be easier to implement. Still, at some point I do want to improve heap efficiency; right now it is a chunk list allocator. I have to search for object references in stack, static, and heap areas ....

    BTW, please say if you have a preference on directory structure for JavaBuild and JavaPropJVM.

    Cheers,
    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-04 22:51
    Result is quit strange... But it really looks like it's when we are going over 0x80000000...

    17523 1817 ticks. 1013 ms. tock0 error(s).
    7FFC0193 7FFBFFF0 diff = 419
    7FFC8099 7FFC7EF6 diff = 419
    7FFD0144 7FFCFF9D diff = 423
    7FFD8086 7FFD7ED9 diff = 429
    17524 1816 ticks. 1012 ms. tick0 error(s).
    7FFE0131 7FFDFF8B diff = 422
    7FFE8034 7FFE7E8D diff = 423
    7FFF00DE 7FFEFF38 diff = 422
    17525 1813 ticks. 1010 ms. tock0 error(s).
    7FFF8B99 7FFF75E6 diff = 5555
    17526 53 ticks. 33 ms. tick1 error(s).
    17527 19 ticks. 14 ms. tock2 error(s).
    17528 18 ticks. 13 ms. tick3 error(s).
    17529 18 ticks. 13 ms. tock4 error(s).
    80000128 7FFFFF8A diff = 414
    17530 18 ticks. 32 ms. tick5 error(s).
    80008018 80007E7C diff = 412
    800100C7 8000FF28 diff = 415
    80018000 80017E57 diff = 425
    17531 1813 ticks. 1010 ms. tock5 error(s).
    8002003D 8001FE98 diff = 421
    800280E0 80027F3A diff = 422
    8003018B 8002FFE5 diff = 422
    800380C6 80037F1D diff = 425
    17532 1811 ticks. 1009 ms. tick5 error(s).
    80040079 8003FED3 diff = 422
    8004812F 80047F89 diff = 422
    80050032 8004FE8C diff = 422
    80058115 80057F6C diff = 425
    17533 1816 ticks. 1012 ms. tock5 error(s).
    
    



    Look like it's not even going to this method....

    JM
  • jazzedjazzed Posts: 11,803
    edited 2010-05-04 23:54
    Ya I saw this in my office before I left today. At least it gives a clue.
    So this is the first round ? I mean it didn't go past FFFFFFFF already right?

    Does this happen on Javelin by any chance?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-05 11:06
    -13028 1812 ticks. 1010 ms. tick5 error(s).
    7FFA807B 7FFA6A58 diff = 5667
    7FFB012F 7FFAFF89 diff = 422
    7FFB8035 7FFB7E8F diff = 422
    7FFC00DC 7FFBFF36 diff = 422
    -13027 1853 ticks. 1033 ms. tock5 error(s).
    7FFC813F 7FFC7F99 diff = 422
    7FFD0040 7FFCFE9A diff = 422
    7FFD80E9 7FFD7F42 diff = 423
    7FFE0193 7FFDFFED diff = 422
    -13026 1816 ticks. 1012 ms. tick5 error(s).
    -13025 18 ticks. 13 ms. tock6 error(s).
    -13024 18 ticks. 13 ms. tick7 error(s).
    -13023 18 ticks. 13 ms. tock8 error(s).
    7FFE9435 7FFE7FD4 diff = 5217
    -13022 54 ticks. 33 ms. tick9 error(s).
    -13021 19 ticks. 14 ms. tock10 error(s).
    -13020 18 ticks. 13 ms. tick11 error(s).
    -13019 19 ticks. 14 ms. tock12 error(s).
    7FFF081B 7FFEF349 diff = 5330
    -13018 53 ticks. 33 ms. tick13 error(s).
    -13017 18 ticks. 13 ms. tock14 error(s).
    -13016 19 ticks. 13 ms. tick15 error(s).
    -13015 18 ticks. 13 ms. tock16 error(s).
    7FFF810B 7FFF7F6C diff = 415
    -13014 19 ticks. 33 ms. tick17 error(s).
    -13013 18 ticks. 13 ms. tock18 error(s).
    -13012 18 ticks. 13 ms. tick19 error(s).
    -13011 18 ticks. 13 ms. tock20 error(s).
    -13010 18 ticks. 13 ms. tick21 error(s).
    80000B6F 7FFFF69D diff = 5330
    800080C5 80007F26 diff = 415
    80010178 8000FFD9 diff = 415
    800180B1 80017F08 diff = 425
    -13009 1848 ticks. 1030 ms. tock21 error(s).
    8002019B 8001FFF5 diff = 422
    800280A9 80027F02 diff = 423
    80030152 8002FFAF diff = 419
    8003808D 80037EE0 diff = 429
    -13008 1818 ticks. 1013 ms. tick21 error(s).
    800400E1 8003FF3A diff = 423
    8004819B 80047FF5 diff = 422
    8005009C 8004FEF6 diff = 422
    80058188 80057FDB diff = 429
    
    



    Same issue few hours later. Again, with the same kind of pattern. (0x800000000)

    I did not get a chance to try with the Javelin yet because it's handling my water heaters and my solar pannels [noparse];)[/noparse] I will try next night.

    JM
  • ChimChim Posts: 16
    edited 2010-05-05 14:04
    Hi everyone,
    Waiting for BradC to solve my RTS related problem, I made another temporary cable link with DTR signal and The link BST works !

    @jazzed : Sadly, I2C.java don't work with The last version. It freezes at a certain point. I don't know why yet. Can you tell me where you use "shiftOut".
    I can send to you my test program.

    @jmspaggi: Thanks for your cool informations...

    See you later.
  • jazzedjazzed Posts: 11,803
    edited 2010-05-05 15:03
    Chim
  • ChimChim Posts: 16
    edited 2010-05-05 15:41
    jazzed said...
    If your test program is different than before, it would be good to see.


    .....

    Did you remove your changes from I2C.java?

    Here is my test program:
    import stamp.core.*;
    import stamp.peripheral.io.*;
    import stamp.util.text.*;
    /**
    ·* Simple command processor
    ·*/
    public class test1 {

    public static void main() {
    ·int s=5000;
    ··// I2C Bus, PCF8591, LT1446, Lcd init
    ··· I2C ioBus = new I2C(PROP.pin29, PROP.pin28);
    ··· PCF8591 ioAdcDac = new PCF8591(ioBus, 0x00, 64);
    ·//LT1446 dacA12bits = new LT1446(PROP.pin15, PROP.pin14, PROP.pin13);
    ·//LCD4094 Lcd = new LCD4094(PROP.pin0,PROP.pin1,LCD_FUNCTION_4BIT_2LINES);
    ·//dac12bits.dac(1024,512);
    ·CPU.delay(30000);
    ·//Lcd.out(Format.sprintf(buffer,"%10u",xtal),buffer);

    ·System.out.print("Hello1");

    ··· if(ioAdcDac.isPresent()){
    ···
    ···························· ioAdcDac.writeDac(100);
    ······· System.out.print("Hello2");
    ··}
    ··· else{
    ······ while ( true ) {

    ··· //CPU.shiftOut(PROP.pin29, PROP.pin28, 8, CPU.SHIFT_MSB, i2cData);
    ······· CPU.writePin(PROP.pin0,true);
    ······· CPU.delay(s);
    ······· CPU.writePin(PROP.pin0,false);
    ······· CPU.delay(s);···
    ··· }
    ··· }
    ···
    ··· while ( true ) {

    ··· System.out.print("Hello3");
    ······· //CPU.writePin(PROP.pin0,true);
    ······· //CPU.delay(s);
    ······· CPU.writePin(PROP.pin0,false);
    ······· System.out.print("_"+ioAdcDac.readAdc());//CPU.delay(s);
    ·····
    ···
    ··· }
    ·}

    }
    jazzed said...

    Did you remove your changes from I2C.java?

    YES

    I'll look at this tomorow...
    Marco
  • jmspaggijmspaggi Posts: 629
    edited 2010-05-05 17:54
    jazzed said...
    Does this happen on Javelin by any chance?

    I tried today and stopped after 18163. Timer was always very stable. Between 1002 and 1005. Never got anything below.

    JM
  • ChimChim Posts: 16
    edited 2010-05-05 19:07
    Finally, I tried by modifying both file pnative and I2C.java with the last version JVM_05_03 to test The I2C.
    It makes the same thing: It freeses after a while who is short.
    So, the problem is somewhere else.

    At tomorow...
  • jazzedjazzed Posts: 11,803
    edited 2010-05-05 21:00
    jmspaggi said...
    I tried today and stopped after 18163. Timer was always very stable. Between 1002 and 1005. Never got anything below.
    Thanks JM. That helps, but it is not the answer I wanted wink.gif

    Looking at the ScaledTimer16 currentTime, it can return small values near the timer roll-over point which is what we're seeing and I'm not sure why ... the math seems to be working though. This leaves me scratching my head a bit and a fix will take more time.

    @Chim
Sign In or Register to comment.