You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • So when you say it counts up/down 100 times between logic 1 and 0, at what frequency?

    I haven't actually checked - at a guess I'd say around 8MHz. It's not entirely accurate because an IRQ could fire during it and knock it off - one of the reasons it's done 100 times.

    it is using the definition of logic high and logic low for thresholds, correct?

    Yes.

    I just gave this a try:

    var TX = D11;
    var RX = D12;
    
    var ll = require("NRF52LL");
    // set up pin states
    digitalWrite(TX,0);
    pinMode(RX,"input");
    // Source of events
    var src = ll.gpiote(0, {type:"event",pin:RX,lo2hi:1,hi2lo:1});
    var dst = ll.gpiote(1, {type:"event",pin:TX,lo2hi:1,hi2lo:1});
    // Counter for crosses
    var ctr = ll.timer(3,{type:"counter"});
    // Set up and enable PPI
    ll.ppiEnable(0, src.eIn, ctr.tCount);
    ll.ppiEnable(1, src.eIn, dst.tOut);
    
    
    setInterval(function() {
      poke32(ctr.tCapture[0],1);
      poke32(ctr.tClear,1);
      var v = peek32(ctr.cc[0]);  
      print(v);
    }, 1000);
    

    And it does do something - but looking at it with a scope for some reason there's a massive delay in the oscillation (it's only 100 times a second), which makes it basically useless. It may be you can tweak it (for instance using the comparator) to make it work better though.

About

Avatar for Gordon @Gordon started