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. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi Eric,
    I'm speechless! Good job I can still type:) From:banghead::banghead::banghead: to :joyful::joyful::joyful:

    I can now read and write, hurray.

    Thanks once again, C.
     
  2. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    I've been trying to set the RegOpMode 0x01 REG ADDRESS of the SX1276
    There is something limiting what values I can write. Here are all of the choices shown on the LCD READ. 0-4-8-12-16-80-64-192-128-132-136-140-144-148-152-156-208. (in the order shown) I don't see how bit 5 can be set to 00100000.
    If I try a similar test, but this time setting the RegBitrateLsb 0x03 REG ADDRESS, I can WRITE/RECEIVE all 0=255 values.
    Any ideas?
    C.

    Here is a section of the code:
     

    Attached Files:

  3. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,085
    Likes:
    640
    Location:
    Ex Yorks' Hants UK
    hi,
    As I recall you want OOK mode.?
    Which means RegOpMode.7 = 0, so I would guess that all not valid bit patterns will not be accepted.

    Please post the actual bit pattern you are trying to Write to the RegOpMode.

    E
     
  4. dave

    Dave New Member

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


     
  5. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.

    Hi Eric,
    Yes, I hope to try OOK first then PSK then hopefully LoRa, but that is ambitious.
    I'm not sure quite how OOK works, but the dtata sheet reads that the Power amplifier is switchded on and off.
    I'm not sue if RegOpMode is switched between standby and Transmit, or run in trnsmit, and switch the PA_LF or RFO_LF high low?

    I'm guessing that SEND to the RegOpMode (Or any address) needs to be done as a byte, but if you think each bit could be set individually, this would be good. I'm trying lots of combinations.
    C.
     

    Attached Files:

  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,085
    Likes:
    640
    Location:
    Ex Yorks' Hants UK
    hi C,
    The device expects a Byte for the Address followed by a Byte for the Data to be written to that Address.
    If you want to see the Bits in a Byte, use

    SPICSOn
    SPISend %10000000' Write to an Address, Set Bits 0 thru 6, to suit the required Bit Address, the RED BIT 7, means this is a WRITE operation.
    WaitUs 10
    SPISend %00001111 ' Set Bits to suit the required Command
    SPICSOff

    I would strongly recommend that you decide which mode of operation you need for your application and focus on getting that working instead of trying combinations.

    It is all in the SX1276 datasheet I have posted.

    E
     
  7. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi Eric,
    All understood, thanks.

    I would have like to understand the more advanced LoRa modulation, but after asking for help in translating LoRa programs written in other languages on many forums, wasn't successful, I am learning the easier basic OOK, which will make a pair of Morse send/receivers. (I'm learning Morse) I can then try to learn the next type FSK. LoRa is very complicated.

    I have asked for advice on the limited SEND choices mentioned above, from the writer of the program at #1. I think once this has been figured out things will fall into place.

    Cheers, C.
     
  8. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    A bit of success:)
    I tried all of the allowed SEND values, and noted that 0x00 and 0x04 turn the SX ON and OFF. (Others do also)
    C.
     

    Attached Files:

  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,085
    Likes:
    640
    Location:
    Ex Yorks' Hants UK
  10. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi Eric,
    Why learn Morse? I'm a radio HAM, and this is what some of us do.

    I looked at your link, thanks, but I can only read write BASIC, and that with difficulty. I've looked at other code for hours, and it just doesn't go in:( although I can sometimes get clues.
    C.
     
  11. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,085
    Likes:
    640
    Location:
    Ex Yorks' Hants UK
    hi C,
    I thought this Thread was related to SX1276 Data Transmission for the Tracker finder.??:rolleyes:

    E
     
  12. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Morning Eric,
    Ultimately it is, but I thought I would learn how the SX12xx work A to B.

    First step OOK, which lends itself to Morse, with it's high power/distance ratio. Then I'll look at FSK which needs a computer, so even though I'm not so interested, others in my HAM club will find it interesting. Then LoRa, which as I've said is complicated, and I simply wouldn't be able to understand it without going through these stages first.

    Using surface mount (New glasses arriving this week:wideyed:) I should be able make little radios and have Morse contact across my area.
    C.
     
  13. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    After getting odd results up to now. I had a suggestion to check which radio Chip I have. This is done by reading the Register default values, and comparing different data sheets. After this test, I found that the radio chip is SX1231, not SX1276. I've added the PDF to #1
    C.
     
  14. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    Just updated my program at #1 The CHIP/MODULE is switching ON/OFF and shows this on an SDRadio :woot:
    C.
     
  15. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    I've established that when the SX1231 is in RX mode it shows it's transmitting, but when in Tx is isn't. Bit of a puzzle.
    I'm guessing that getting it to transmit in TX mode, there are many settings to get correct.
    Anyone have ideas?
    C.
     
  16. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,085
    Likes:
    640
    Location:
    Ex Yorks' Hants UK
    hi C,
    When you say, when the SX1231 is in RX mode it shows it's transmitting, is ambiguous, could you explain in more detail how you checked the TX RX.?

    Which mode of Transmission are you using.?

    E
     
  17. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi Eric,
    I've posted the TEST program in #1. RegDataModul set to OOK, Continuous...........RegPaLevel set to PA0 ON, POWER 31 (11111) ..............RegOpMode switched between TX and RX. When TX shown on LCD DATA=128 and shows nothing on SDR# (See image) RX shown on LCD=132 and shows a signal on SDR#
    C.
     

    Attached Files:

    Last edited: Dec 8, 2016
  18. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,085
    Likes:
    640
    Location:
    Ex Yorks' Hants UK
    hi C,

    Refer these two images.
    You ONLY OR the Reg Addresses for a Write Command, NOT the Data being Written to the Regs
    E

    Const regopmode = 0x01
    Dim wregopmode As Byte
    wregopmode = 0x01 Or 0x80 'Or 0x80 switches bit7 ON. This is needed to SPI change address value.

    'DATA
    Dim standbymode As Byte 'Including the rest of the byte
    standbymode = 0x01 '%10000001
    Dim fsmode As Byte 'Frequency synthesizer
    fsmode = 0x82 '%10000010
    Dim txmode As Byte '%10000011 ; Why is the TX mode Bit7 Set High.????
    txmode = 0x83

    Dim rxmode As Byte '%10000100
    rxmode = 0x84

    'ADDRESS
    Const regdatamodul = 0x02 '0x48 '%01001000 6-5=11 Cont without. 4-3=01 OOK
    Dim wregdatamodul As Byte
    wregdatamodul = 0x02 Or 0x80
    'DATA
    Dim contookmode As Byte 'RegDataMode
    contookmode = 0x68 '%01101000

    'ADDRESS
    Const regpalevel = 0x11
    Dim wregpalevel As Byte
    wregpalevel = 0x11 Or 0x80
    'DATA
    Dim pa0onpower31 As Byte 'Output power 31 =11111
    pa0onpower31 = 0x9f

    SPIPrepare
    WaitMs 5000

    mainloop:
    'SPI=====================================================
    SPICSOn
    SPISend wregopmode 'RegOpMode
    SPISend txmode 'TX MODE ; You are writing 0x83 to REG.
    SPICSOff
     

    Attached Files:

    • A01.gif
      A01.gif
      File size:
      23.1 KB
      Views:
      38
    • A02.gif
      A02.gif
      File size:
      29.4 KB
      Views:
      39
  19. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    C.
     
  20. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,085
    Likes:
    640
    Location:
    Ex Yorks' Hants UK
    hi C,
    E

    Const regopmode = 0x01 ' this is the Operating Mode Register of the Transceiver

    Dim wregopmode As Byte
    wregopmode = 0x01 Or 0x80' Setting Bit7 High means its a Write to Register command.

    Dim txmode As Byte
    txmode = 0x03 ' Transmit Mode,,, Frequency Synth and Transmitter Enabled

    'example:
    'Write to RegOpMode Reg

    SPICSOn
    SPISend wregopmode ' write to register address
    SPISend txmode 'Frequency Synth and Transmitter Enabled
    SPICSOff
     
    • Dislike Dislike x 1
  21. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,242
    Likes:
    11
    Location:
    Dorset UK.
    Hi Eric,
    I have changed the settings, and updated the OOK program in #1, back to a couple of days ago, so there is no added BIT.7s on the TX RX modes.
    This is giving the same result. When it shows RX on the LCD, It shows a signal on SDR# When it shows TX on the LCD it shows nothing on SDR#.

    Note: If I don't send anything, just switch on the SX1231, it shows a signal on the SDR# (RegOpMode default = STANDBY)

    I think the SX1231 sometimes needs to be in STANDBY to change registers, so now I am trying a switch between STANDBY and instead of fixed settings written to RegOpMode this test will go through all of the DATA (DATA = DATA +1) choices, and I'll see what's shown on the LCD. [[I hope this is understandableo_O]]
    C.
     

Share This Page