1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

DATA transmission/receiving using SCR Radio modules.

Discussion in 'Oshonsoft' started by camerart, Oct 10, 2016.

  1. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,847
    Likes:
    623
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi,
    regopmode address 0x01

    data bits
    0 = FSK/OOK : change allowed in SLEEP Mode ONLY
    01 = OOK
    0 =Res
    1 = LF mode
    101 = rec mode rx

    0,01,0,1,101 == 0x2D

    Is the unit in Sleep Mode.?

    E
     
  2. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi Eric,
    You've come to the same result 0x2d, good.
    Have you looked at the Rx program in #1? Hopefully, I have set-up correctly, sleep then write RX.
    Must be somethingelse?
    C.
     
  3. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,847
    Likes:
    623
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi,
    Used in your other thread:

    "The SPI interface gives access to the configuration register via a synchronous full_duplex protocol corresponding to CPOL=1 and CPHA=0 in Motorola/Freescale nomenclature. Only the slave side is implemented."

    E

    My plot shows...using your program

     

    Attached Files:

  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.

    Hi Eric,
    Yes, this is what I get too. It's as near to the Oshonsoft SPI timing diagram.
    It looks as though the Oshonsoft NSS CS runs low then goes high, then as it goes low again starts the sequence. I couldn't get it to run as my yellow line on the attachment.
    I am able to change the MODE as long as it isn't RX. I'll keep trying different cominations.
    C
     

    Attached Files:

  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,847
    Likes:
    623
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi C,
    The point I am raising is the clock sense.
    Image 002 is the sense that the SX expects according to your earlier posts.
    Image003 is what you are using to communicate with the SX. PORTC.3

    E
    A002.gif A003.gif

    EDIT:

    Look at this link.
    http://hackaday.com/2016/07/01/what-could-go-wrong-spi/
     
    Last edited: Feb 4, 2017
  7. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi Eric,
    Much to read and understand!
    Using the set-up shown on my DOC where in simple terms, after the point where the NSS going LOW the SCK goes HIGH/LOW repeatedly in time with the MOSI going HIGH/LOW. I'll clean up my understanding later. On my DATA sheet CPOL =0 as shown in my DOC, on your last post your DATA sheet show CPOL=1, unless I'm misunderstanding.

    In the mean time, there are many combinations to grapple with.
    1/ If I WRITE 0x0d in RegOpMode OOK-0, FSK-00, RES-0, LOW-1, RX101 The result on the READ LCD is 45 = 0x2d which is what we want.
    This is receiving signals as I switch on the TX.

    From a quick scan of your SPI link, it reminds me that there is a fascility to synchronise the signal with DIO1/DCLK, I've yet to try this.
    C.
     
  8. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi,
    I changed the TX inside the 'mainloop' to simple on/off each second. On the RX, an oscilloscope on DATA shows a signal being received but is not transfered to the PIC because of the 3.3V-5V mismatch. This should be ok, once I've got 3.3V PICs.
    The received signal is broken, which could be that I had to use FSK instead of OOK.

    EDIT: Tried WRITING 0x2d to RegOpMode on RX. The LCD shows 0x2c, but it is receiving ok.
    Regarding the broken received signal, this could be because it's a tone???

    C.
     
    Last edited: Feb 4, 2017
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,847
    Likes:
    623
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi,
    On the SDI line do you have a 10k pull up to +5v.?

    I don't understand
    Regarding the broken received signal, this could be because it's a tone???

    E
     
  10. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi Eric,
    I have a thought at the back of my mind regarding the 10K pull up on one of the SPI connections. I thought it was MISO/SDO though. I put it on the back burner, because I had to put 22K resistors in series on all SPI connections, instead of matching the voltages. I'll get some 10K resistors for the new 3.3v circuits.

    The TX/RX signals are tones as you would hear with Morse. I just connected an earphone to the DATA pin on the RX and it sounds like the end of a record pulsing on and off in time with the TX.
    C.
     
  11. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi Eric,
    I found a note on the program reminding me about a 10K pull up on the MISO line, so depending on whether your questions was from the SX perspective or the PIC perspective, that may be the answer. This is why I've adopted MISO and MOSI terminology :)
    C.
     
  12. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,847
    Likes:
    623
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi C,
    How are you down level shifting between the PIC at 5v and the SX at 3.3v.?
    C select, Clock and SDO [ MOSI]
    E
     
  13. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi Eric,
    The Sx has clamped inputs at 3.3v, and following a suggestion for the test circuits added 22K resistors in series on all lines. This is working, but the RX cannot switch the PIC input because of the low voltage.
    Next step is to order surface mount components, then they will be voltage matched (not sure about the LCD though) . Some of the surface mount components are very small, so I'm trying to figure out the larger ones.
    So far I've made my own circuits photographically, but perhaps not this time, as the PIC is 18mm long with 14 pins each side.
    C.
     
  14. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi,
    I've made a new test circuit using fuse wire as tracks (spaghetti wiring:eek:) Using an 18LF2520 surface mount PIC connected directly to the SX1278. Generally the same circuit as posted.

    I had a few issues with 3.3V programming, but after setting MPLAB.IPE to 3.375V and changing the Pickit3 external power supply to 3.3V, things settled down.

    I bought a digital analyzer, see image: While it shows timing, it doesn't show slopes in the square waves.

    The circuit is now working as TX. Next see if I can get it to RX.

    C.
     

    Attached Files:

    • SPI.jpg
      SPI.jpg
      File size:
      164.4 KB
      Views:
      11
  15. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,847
    Likes:
    623
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi C,
    Ref your PM.
    If I follow the SX datasheet spec for the SPI, it suggests that the clock should be High at rest, going low for the Clock period. [you show it the opposite sense]

    You say that you can Write/Read the SX registers OK with the Clock as shown in your image, if that is the case, I would move onto the next stage of the project.

    E
     
  16. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi Eric,

    I've attached a clip from my SX1278 data sheet. To me it looks as if the clock/SCK is low at rest and goes high for the clock period.

    C.
     

    Attached Files:

  17. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,847
    Likes:
    623
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi C,
    You did post in an earlier post:
    "The SPI interface gives access to the configuration register via a synchronous full_duplex protocol corresponding to CPOL=1 and CPHA=0 in Motorola/Freescale nomenclature. Only the slave side is implemented."

    Which suggests a Clock High at rest, going low when clocked.

    Your clip in #95 states CPOL=0.

    One of the statements is incorrect.
    As the SPI works OK using CPOL=0 I would say the 1st statement is wrong.

    E
    A001.gif
     
  18. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi Eric,
    I've been through all of my module PDFs and they all show See attached: I don't know where I got the first statement from, but as you say it is incorrect.

    There is an issue when I try to program for RX. As I've now got 5x SX1278s all with the same issue, it must be a rule I've broken, which I'll have to find. The problem is: When programming TX the LCD reads what I have programmed, and reports TX, then transmits ok. When I try RX, the LCD never reports RX, but changes it to FSRX. which may be correct, I'm not sure.
    C.
     

    Attached Files:

    • SPI.jpg
      SPI.jpg
      File size:
      191.6 KB
      Views:
      11
  19. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi,
    Looking at the logic analyser readings See attached:
    STANDBY shows the RegOpMode setting 0x01, plus the write bit 10000001, then the reading which is STANDBY including the OOK and LOW Frequency bits 00101001 written with MISO, then it is reflected in the MOSI reading.

    TX shows RegOpMode then TX in MOSI reflected in MISO

    RX shows RegOpMode then RX in MOSI, but incorrectly reflected in the MISO reading.

    I realise that the logic analyser doesn't shows square wave errors, but does appear to show some switching accuracy, but the readings appear to show that Oshonsoft is programming the PIC correctly.

    C.
     

    Attached Files:

  20. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi,

    It's been pointed out to me that the missing bit when the PIC controls the SX1278 with RX is most likely to be the SPI timing.

    C.
     
  21. camerart

    camerart Member

    Joined:
    Jun 12, 2008
    Messages:
    983
    Likes:
    8
    Location:
    Dorset UK.
    Hi,
    I am trying to set-up CLKOUT from the SX1278 as OSC IN on the 18LF2520. See attached: It shows this is advisable for synchronisation.

    At the moment the PIC is not oscillating, so something's wrong.

    Here's the program:

    I'm a bit vague about all of the settings.
    C.
     

    Attached Files:

Share This Page