Menu

picaxe conversion

Help
2020-12-04
2021-02-18
<< < 1 2 3 4 .. 7 > >> (Page 2 of 7)
  • Chris Roper

    Chris Roper - 2021-01-20

    Not sure who told you That Stan but Here is an example of Me using it to Fine tune the timing of a Soft UART in XC8.

    Here is the full story but fair warning - "C Code Ahead"
    Tutorial - Advanced Debugging and Code Porting with Mid Range PIC’s

     
    • stan cartwright

      stan cartwright - 2021-01-20

      I have not checked your link Chris as I am not into pics really but it was posted that a pickit was useless and a ttl to usb converter needed by someone respected on gcb forum.
      can't be bothered being sherlock holmes to find who.
      Thanks anyway.
      gcb seems to get more complicated every day! :)

       
    • Haroen

      Haroen - 2021-01-21

      I read it also some time ago

       

      Last edit: Haroen 2021-01-21
  • Haroen

    Haroen - 2021-01-21

    Stan: I have not used pull up resistors for i2c with tof10120 yet. Should I ?

    I didn't and it worked ok.

     

    Last edit: Haroen 2021-01-21
  • stan cartwright

    stan cartwright - 2021-01-20

    used 3.8K pull ups and used 0xF4 as address and got this on terminal

     
    • Haroen

      Haroen - 2021-01-21

      No PullUps Stan.

       
  • Anobium

    Anobium - 2021-01-20

    I am going to ask a dim question @Stan - is this the same device as Haroens sensor?

     
  • stan cartwright

    stan cartwright - 2021-01-20

    in the code

    ;Distance variables
    dim distance_lo, distance_hi as word
    dim Distance as word
    

    should that be byte as later

    Distance=distance_hi*256+distance_lo
    hserprint "Distance= "+str(Distance)+" mm"
    
     
  • stan cartwright

    stan cartwright - 2021-01-20

    I ask that myself Evan :)
    I came across it on checking what picaxe up to and Haroen seemed to have a picaxe version working.
    Haroen, is this the same device?
    pins
    gnd
    vdd
    rx
    tx
    sda
    scl
    that info could be wrong.

     

    Last edit: stan cartwright 2021-01-20
    • Anobium

      Anobium - 2021-01-20

      @Stan.

      There is something wrong. In the datasheet the address is 0xA4. the PICAXE code is $A4, Haroen code uses 0xA4 but you think your address is 0xF4

      This is the root cause. You could assume the device address is different and therefore a difference device. But, I do not think this is the case.

      0xF4 is 0b1111  0100 and 
      0XA4 is 0b1010 0100
      

      Looks the first nibble on your 0XF4 address.. all the bits are high. And, the second nibble is the same.

      I think you need to sort this - my guess is your address is 0XA4 and you are getting rubbish reads.

      So, post your code - let us look.

       
  • stan cartwright

    stan cartwright - 2021-01-20

    I didn't write the i2c address finder :)
    I used a uno which has built in pull up for i2c but not set that up and use as normal.
    i2c finder gives same address with or without 3.8k pull up resistors.
    using 0xA4 gives constant error I2C Ack error.
    Haroen got it to give serial results???
    may be it is faulty device.

    maybe gcb i2c address finder wrong but works for other i2c like ssdxxx or port expander.
    I don't really understand arduino and picaxe i2c being different to gcb i2c addresses...
    like gcb uses full address.
    This isn't basic it's complicated stuff doh :(

    so is gcb i2c address finder results to be used or what?
    I think there's more to this device's implementation.

     

    Last edit: stan cartwright 2021-01-20
    • Anobium

      Anobium - 2021-01-20

      Please post your code, or, did you ? if so, where?

       
  • Haroen

    Haroen - 2021-01-21

    I ask that myself Evan :)
    I came across it on checking what picaxe up to and Haroen seemed to have a picaxe version working.
    Haroen, is this the same device?

    Yes I think it is!

    pins:
    gnd
    vdd
    rx
    tx
    sda
    scl

    Looks like my connections too! Try switching sda with scl because you know chinese :-)

    I don't get any "I2C ack error" like Stan has in his tof10120address.jpg!

    used 3.8K pull ups and used 0xF4 as address and got this on terminal

    No need for PullUps Stan.

    don't work
    https://drive.google.com/file/d/1uaMZ421smI0FN40iJgn-ZKQG42KUvFfh/view
    https://drive.google.com/file/d/1uaMZ421smI0FN40iJgn-ZKQG42KUvFfh/view

    Sorry, I have now corrected all datasheet links in my posts.

    This isn't basic it's complicated stuff doh :(
    so is gcb i2c address finder results to be used or what?
    I think there's more to this device's implementation.

    Hang on Stan, we will try to get yours working!

     
  • Anobium

    Anobium - 2021-01-21

    Stan's issue is that he is running at 400mbits not 100mbits. He has not posted his code but my guess he is overloading the sensor.

     
  • Haroen

    Haroen - 2021-01-21

    @Stan, This is my picture attachment and try to duplicate the projects wiring and on exact these Arduino NANO pins.
    Try it with Anobiums latest code without changing anything, just copy and paste.
    The default I2C address will be used for now.
    Let us know how that went.

     
  • stan cartwright

    stan cartwright - 2021-01-21

    Tried programs posted and mine but i2c finder says address 0xF4.
    it's only 2 wires.

     
    • stan cartwright

      stan cartwright - 2021-01-24

      In your photo the t0f10120 supplu-red is going to nano VIN ! not +5V

       
  • Anobium

    Anobium - 2021-01-21

    OK. Back to basics. What is the voltage on the sensor? voltage on both i2c lines? then, remove power - what is resistance between supply voltage and data line, and, resistance between supply voltage and clock line?

     
  • stan cartwright

    stan cartwright - 2021-01-22

    The sensor is too easily shorted (ie too small to probe) but the 5V supply is 4.88V, ie uno 5V pin.
    sda to gnd=4.88V
    scl to gnd=0V
    resistance device supply, unplugged from uno, meter pos probe to device V+supply in, -probe to
    scl=11.5 Meg ohm
    same with probes swapped.

     
  • Anobium

    Anobium - 2021-01-22

    OK.

    What is the R on SDA?


    11k5 on SCL would required a clock speed of walking pace. Was the power turned off?

     

    Last edit: Anobium 2021-01-22
  • stan cartwright

    stan cartwright - 2021-01-22

    then, remove power - what is resistance between supply voltage and data line, and, resistance between supply voltage and clock line?

    Do you mean leave the tof10120 connected to uno and measure resistance with no power?
    There's nothing wrong with uno or nano I use to test this. I tried ssd1306 and that works and is i2c.

    This would not be the first fleabay device to not work if you know what I mean.
    I think they sell them and by the time you figure how they work you find it's faulty but then it's too late to send it back...imho :)

    ps thanks for reply, know you are busy

     

    Last edit: stan cartwright 2021-01-22
  • Anobium

    Anobium - 2021-01-22

    then, remove power - what is resistance between supply voltage and data line, and, resistance between supply voltage and clock line?

    No. I mean. what is the resistance on the clock line (and data line) with no power to the 5v0 rail. Do a set of measures with the sensor connected, and ,not connected. So, you have 4 results to post.

    Sensor connected
    1 DATA to 5v rail
    2 CLOCK to 5v rail
    Sensor disconnected
    3 DATA to 5v rail
    4 CLOCK to 5v rail

     
  • Haroen

    Haroen - 2021-01-23

    Is this method how all I2C devices can be checked?

     
<< < 1 2 3 4 .. 7 > >> (Page 2 of 7)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.