[Oberon] FPGA - nRF24L01 connection

Tomas Kral thomas.kral at email.cz
Fri Apr 13 18:24:16 CEST 2018


On Fri, 13 Apr 2018 10:46:11 +0300
Jörg <joerg.straube at iaeth.ch> wrote:

> The easiest is to only use pipe 0.
Hi,

Some progress made. I can now send payloads back and forth.
Best results with `RF24.lib' I have using two pipes, I receive on
pipe-1 and send on pipe-0.
But, but, outbound 90% loss, inbound 0% loss. Oberon receives much
better!!! Packets received on RPI are marked with payload[len-1]:='x'.

RPI:
---
RX_ADDR_P0-1	 = 0xc2c2c2c2c2 0xe7e7e7e7e7
RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
 Output below : 
Recv: size=31 payload=0123456789012345678901234567890 pipe=1
Send: size=31 payload=012345678901234567890123456789x pipe:1 Recv:
size=31 payload=0123456789012345678901234567890 pipe=1	 Send:
size=31 payload=012345678901234567890123456789x pipe:1

Oberon:
------
 snd-timed
 snd-timed
 snd-timed
 snd-timed
012345678901234567890123456789x rcv-done
 snd-done
 snd-timed
 snd-timed
 snd-timed
 snd-timed
 snd-timed
 snd-timed
 snd-timed
012345678901234567890123456789x rcv-done
 snd-done

Ping/Pong procedures, they borrow from `SCC.Mod', just in case you spot
something odd.

 PROCEDURE Pong*;
    VAR plstr: ARRAY 32 OF CHAR; adr: INTEGER;
      payload: ARRAY SubPacket OF BYTE;
  BEGIN
    IF SCC.Rcvd(Wait) THEN plstr := "";
      adr := SYSTEM.ADR(payload); SCC.SubRcv(adr);
      SYSTEM.COPY(SYSTEM.ADR(payload), SYSTEM.ADR(plstr), 8);
      Texts.WriteString(W, plstr); Texts.WriteString(W, " rcv-done")
    ELSE Texts.WriteString(W, " rcv-timed") END;
    Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf)
  END Pong;

  PROCEDURE Ping*;
    VAR plstr: ARRAY 32 OF CHAR; i: INTEGER;
      payload: ARRAY SubPacket OF BYTE; timeout: BOOLEAN;
  BEGIN    
    plstr := "0123456789012345678901234567890";
    SYSTEM.COPY(SYSTEM.ADR(plstr), SYSTEM.ADR(payload), 8);
    i := Kernel.Time() + Wait;
    REPEAT SCC.SPICtrl({netEnable, netSelect}); SCC.SPI(0FFH);
  SCC.SPICtrl({netEnable}) (*NOP*) UNTIL Kernel.Time() >= i;
    SCC.Listen(FALSE);
    SCC.SubSnd(SYSTEM.ADR(payload), timeout); SCC.Listen(TRUE);
    IF timeout THEN Texts.WriteString(W, " snd-timed") ELSE Pong();
  Texts.WriteString(W, " snd-done") END; Texts.WriteLn(W);
  Texts.Append(Oberon.Log, W.buf) END Ping;



-- 
Tomas Kral <thomas.kral at email.cz>


More information about the Oberon mailing list