MRF90XAM9A interfacing help


Closed Thread
Results 1 to 40 of 64

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    I have a few ideas but let me have a day or two to noodle through it.
    Regards,
    TABSoft

  2. #2
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    I changed some of the register settings after re-reading the DS for a gazillion-ith time still no luck. I do get an IRQ0 pulse now, but I don't think I set it??
    Slightly modified code for continuous xmit and receive (different code for the 2 units).
    Code and registers below:
    Code:
    'Constants here
    '     RF_Init_Values[0] = $28                                                   'Standby mode, 915-928 MHz, VTune by inductors, ENABLE R1/P1/S1
         RF_Init_Values[0] = $68                                                   'RECEIVE mode, 915-928 MHz, VTune by inductors, ENABLE R1/P1/S1
         RF_Init_Values[1] = $8C                                                   'FSK, max IF gain, Packet Mode
         RF_Init_Values[2] = $03                                                   '100KHz Freq Dev
         RF_Init_Values[3] = $07                                                   '25 KBps
         RF_Init_Values[4] = $0C                                                   'for OOK mode, not apliable
         RF_Init_Values[5] = $0F                                                   '16Bytes FIFO, 
         RF_Init_Values[6] = $77                                                   '915MHz R1 Reg
         RF_Init_Values[7] = $64                                                   '915MHz P1 Reg
         RF_Init_Values[8] = $32                                                   '915MHz S1 Reg
         RF_Init_Values[9] = $74                                                   '920MHz R2 Reg
         RF_Init_Values[10] = $62                                                  '920MHz P2 Reg
         RF_Init_Values[11] = $32                                                  '920MHz S2 Reg
         RF_Init_Values[12] = $38                                                  'config mode for OOK, not apliable
         RF_Init_Values[13] = $08                                                  'RCV:IRQ0=payload ready + IRQ1=CRC OK
                                                                                   'TX: IRQ1=TXdone
         RF_Init_Values[14] = $35                                                  'FIFO starts filling when SYNC detected,TXDONE goes hi when done,
                                                                                   'RSSI IRQ when is above level set, enable PLL lock
         RF_Init_Values[15] = $00                                                  'RSSI interupt level zero - minimum
         RF_Init_Values[16] = $A3                                                  'default filters config
         RF_Init_Values[17] = $38                                                  'default filters config
         RF_Init_Values[18] = $30                                                  'sync word ON, 24bits, 0 errors tolerance
         RF_Init_Values[19] = $07                                                  'reserved reg
         RF_Init_Values[20] = $00                                                  'RSII status read register, 0.5dB / bit
         RF_Init_Values[21] = $00                                                  'OOK config reg
         RF_Init_Values[22] = $53                                                  '"S" 1st byte of sync word
         RF_Init_Values[23] = $43                                                  '"C" 2nd byte of sync word
         RF_Init_Values[24] = $53                                                  '"S" 3rd byte of sync word  - my initials!
         RF_Init_Values[25] = $00                                                  '
         RF_Init_Values[26] = $70                                                  'Cutoff fcy = 200KHz, output power = 13dBm 0b000
         RF_Init_Values[27] = $BC                                                  'clk out by default 427KHz
         RF_Init_Values[28] = $03                                                  '3 bytes payload
         RF_Init_Values[29] = $01                                                  'initial MAC ADDRESS, only for test
         RF_Init_Values[30] = $5E                                                  'Fix Packet Lenght, 3 bytes preamble, whitening ON, CRC ON, Node ADDR|0x00|0xFF filtering
         RF_Init_Values[31] = $80                                                  'FIFO autocreal enable if CRC fails, Write to FIFO in stby mode 
    
    'MRF initialization here
    debug "@ MRF init", 10
                MRFConfigSel=0                                                      'Select the chip       
    'Going to try using shiftout before using hardware SPI
                for i=0 to 31                                                       'Sets up the index var for data
                    MRFaddr=(i << 1)                                                'Shifts address 1 bit to left, automatically gets start,write, and stop bits      
                    SHIFTOUT SDO, SCLK, 1,[MRFaddr,RF_Init_Values(i)]               'send data to register
    debug "Addr=",bin8 MRFaddr,"  Value=",hex2 RF_Init_Values[i],13
                next i    
                MRFConfigSel=1                                                      'Deselect the chip
    
    'Try to read back some registers as a test to see if they were written correctly            
                MRFConfigSel=0                                                      'Select the chip 
                for i = 0 to 7                                                      'Sets up address to read
                    MRFaddr=((i << 1) | $40)                                       'Shifts left 1 bit, sets $40 bit, automatically gets start, READ, and stop bits
                    SHIFTOUT SDO, SCLK, 1,[MRFaddr]                                'Address to read
                    SHIFTIN SDI, SCLK, 0,[MRFSPIdata]                              'Get data from reg
                    debug "MRF Config data: i=", dec1 i, "   Register ", bin8 MRFaddr, "   Data=", hex2 MRFSPIdata,13
                next i
    
    'Try sending something
    debug "Try sending 3 bytes",13
    XMIT_EN:   i=0                                                                 'Register of interest
               MRFaddr=(i<<1)                                                      'Gets register address format
               MRFConfigSel=0                                                      'Select the chip
               SHIFTOUT SDO, SCLK, 1,[MRFaddr,$88]                                 'send data, TRANSMIT, 915-928, Vtune by tank caps, Enable R1 P1 S1
               MRFConfigSel=1                                                      'Deselect the chip
               
    XMIT:      MRFDataSel=0
               SHIFTOUT SDO, SCLK, 1,[$A1]
               MRFDataSel=1
               MRFDataSel=0
               SHIFTOUT SDO, SCLK, 1,[$B1]
               MRFDataSel=1
               MRFDataSel=0
               SHIFTOUT SDO, SCLK, 1,[$C1]
               MRFDataSel=1
               
               i=0                                                                 'Register of interest
               MRFaddr=(i<<1)                                                      'Gets register address format
               MRFConfigSel=0                                                      'Select the chip
               SHIFTOUT SDO, SCLK, 1,[MRFaddr,$28]                                 'STANDBY, 915-928, Vtune by tank caps, Enable R1 P1 S1
               MRFConfigSel=1                                                      'Deselect the chip
    
    '           goto XMIT_EN                                                        'Remark this line to be receive all the time, otherwise its xmitting all the time
    
    RCV:       i=0                                                                 'Register of interest
               MRFaddr=(i<<1)                                                      'Gets register address format
               MRFConfigSel=0                                                      'Select the chip
               SHIFTOUT SDO, SCLK, 1,[MRFaddr,$68]                                 'send data, RECEIVE, 915-928, Vtune by tank caps, Enable R1 P1 S1
               MRFConfigSel=1                                                      'Deselect the chip
               
    Wait4Pkt:  If MRFIrq0=1 and MRFIrq1=1 then
                  MRFDataSel=0                                                     'Select chip cuz we have a packet ready and CRC is good
                  SHIFTIN SDI, SCLK, 0,[data3]                                     'Get data from reg   
                  MRFDataSel=1                                                     'De-Select chip
                  MRFDataSel=0                                                     'Select chip cuz we have a packet ready and CRC is good
                  SHIFTIN SDI, SCLK, 0,[data2]                                     'Get data from reg  
                  MRFDataSel=1                                                     'De-Select chip
                  MRFDataSel=0                                                     'Select chip cuz we have a packet ready and CRC is good
                  SHIFTIN SDI, SCLK, 0,[data1]                                     'Get data from reg  
                  MRFDataSel=1                                                     'De-Select chip
    debug "MRF payload:  Data3=",hex2 data3,"   Data2=",hex2 data2,"   Data1=",hex2 data1,13
               endif
               goto Wait4Pkt
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

  3. #3
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    I went through the datasheet again, and again.
    I also went through Microchips MRF Radiodriver software source code, link here.

    Here is what I put together, see if this helps at all.......

    Code:
         RF_Init_Values[0] = $28                                                   'Standby mode, 915-928 MHz, VTune by inductors, ENABLE R1/P1/S1
         RF_Init_Values[1] = $8C                                                   'FSK, max IF gain, Packet Mode
         RF_Init_Values[2] = $0B                                                   'Change from 200KHz Freq Dev to 33KHz Dev
         RF_Init_Values[3] = $63                                                   '2KBps
         RF_Init_Values[4] = $0C                                                   'for OOK mode, not apliable
         RF_Init_Values[5] = $03                                                   '16Bytes FIFO, 3 Bytes threshold FIFO transmit interrupt
         RF_Init_Values[6] = $77                                                   '915MHz R1 Reg
         RF_Init_Values[7] = $64                                                   '915MHz P1 Reg
         RF_Init_Values[8] = $32                                                   '915MHz S1 Reg
         RF_Init_Values[9] = $74                                                   '920MHz R2 Reg
         RF_Init_Values[10] = $62                                                  '920MHz P2 Reg
         RF_Init_Values[11] = $32                                                  '920MHz S2 Reg
         RF_Init_Values[12] = $38                                                  'config mode for OOK, not apliable
         RF_Init_Values[13] = $08                                                  'PLREADY, CRCOK, TXDONE, FIFO Not Full, FIFO Empty, No FIFO Overrun
                                                                                   'TX: mostly normal
         RF_Init_Values[14] = $0B                                                  '00111001
         RF_Init_Values[15] = $00                                                  '
         RF_Init_Values[16] = $41                                                  'default filters config
         RF_Init_Values[17] = $38                                                  'default filters config
         RF_Init_Values[18] = $30                                                  'sync word ON, 24bits, 0 errors tolerance
         RF_Init_Values[19] = $07                                                  'reserved reg
         RF_Init_Values[20] = $00                                                  'RSII status read register, 0.5dB / bit
         RF_Init_Values[21] = $00                                                  'OOK config reg
         RF_Init_Values[22] = $53                                                  '"S" 1st byte of sync word
         RF_Init_Values[23] = $43                                                  '"C" 2nd byte of sync word
         RF_Init_Values[24] = $53                                                  '"S" 3rd byte of sync word  - my initials!
         RF_Init_Values[25] = $00                                                  '
         RF_Init_Values[26] = $F0                                                  'utoff fcy = 200KHz, output power = 13dBm 0b000
         RF_Init_Values[27] = $80                                                  'clk out by default 427KHz
         RF_Init_Values[28] = $03                                                  '3 bytes payload
         RF_Init_Values[29] = $01                                                  'initial MAC ADDRESS, only for test
         RF_Init_Values[30] = $4E                                                  'Fix Packet Lenght, 3 bytes preamble, whitening ON, CRC ON, Node ADDR|0x00|0xFF filtering
         RF_Init_Values[31] = $00                                                  'FIFO autocreal enable if CRC fails, Write to FIFO in stby mode     for (i = 0; i < 32; i++)
        
    RF_STANDBY     con $20      'Standby RF Mode     
    RF_SYNTHESIZER con $40      'Synthesizer Mode (Test if RF Module is on and PLL Locked and working)
    RF_RECEIVER    con $60      'Receive Mode
    RF_TRANSMITTER con $80      'Transmit Mode
    
    TxPacket var byte[16]   'Packet Buffer
    bRF_Mode var byte       'Used to set RF Mode
    RF_Mode var byte
    wr_FIFO_Val var byte    'byte to load into RF FIFO
    bReg_Address var byte   'byte for which register to set/read
    bReg_Value var byte     'Value of register to set/read
    TxPacketLen var byte    'Number of bytes to send
    i var byte    
    PLL_LOCK var bit        'Bit to read PLL Lock Flag
    
    
    TestMe:
        gosub MRFInint
        TxPacket[0] = $A1
        TxPacket[1] = $B1
        TxPacket[2] = $C1
        TxPacketLen = 3
        gosub Send_Packet
        bRF_Mode = RF_STANDBY
        gosub SetRFMode
    
        goto RCV    'This is a jump to your receive routine
        
    MRFInit:
    'Initialize the MRF Module
        'Intial setup
        for i = 0 to 31
            bReg_Address = i
            bReg_Value = RF_Init_Values(i)
            gosub RegisterSet    
        next i
    
        'Test the module setup
        'Clear the PLL Lock flag by setting LSTLPLL to 1
        bReg_Address = $0E  'FTPRIREG
        gosub RegisterRead
        bReg_Value = bReg_Value | $02   'Set LSTLPLL to 1
        gosub RegisterSet   'Clear the flag
        
        'Enable Synthesizer mode and test LSTSPLL stays at 1 (PLL Locked)
        bRF_Mode = RF_SYNTHESIZER
        gosub SetRFMode
    
        'Verify PLL Lock Flag
        bReg_Address = $0E  'FTPRIREG
        gosub RegisterRead
        PLL_LOCK = 0
        PLL_LOCK = bReg_Value.1
        'You can test this bit to see if PLL Is Locked
        
        'Change to Standby  
        bRF_Mode = RF_STANDBY
        gosub SetRFMode
        
        return
    
    Send_Packet:
        
        'Set Standby mode
        bRF_Mode = RF_STANDBY
        gosub SetRFMode
        
        'Enable FIFO access in Standby mode
        bReg_Address = $1F  'Register 31
        bReg_Value = (RF_Init_Values(bReg_Address) & $BF) | $00
        gosub RegisterSet
        
        'Clear FIFO Overrun
        bReg_Address = $0D  'Register 13
        bReg_Value = (RF_Init_Values(bReg_Address) | $01)
        gosub RegisterSet
        
        'Set PLL Locked
        bReg_Address = $0E  'Register 13
        bReg_Value = (RF_Init_Values(bReg_Address) | $02)
        gosub RegisterSet
        
        For i = 0 to (TxPacketLen-1)
            'Wite the Packets to the FIFO
            wr_FIFO_Val = TxPacket[i]
            gosub WriteFIFO
        Next i 
       
        'Set RFMode to Transmit
        bRF_Mode = RF_TRANSMITTER
        gosub SetRFMode
        pause 5 'Pause 5ms
        
        return
            
    WriteFIFO:
    'Inputs: wr_FIFO_Val
        
        MRFDataSel=0                
        SHIFTOUT SDO, SCLK, 1,[wr_FIFO_Val] 
        MRFDataSel=1                
    
        return
        
    SetRFMode:
    ' Inputs bRF_Mode
        'SetRFMode(RF_STANDBY); (mcparam0_read & 0x1F) | RF_STANDBY) = (6E & 1F) | 20 = 2E
        bReg_Address = $00  'MCPARAM0
        gosub RegisterRead
        mcparam0_read = bReg_Value
        bReg_Value = (bReg_Value & $1F) | bRF_Mode
        bReg_Address = $00
        gosub RegisterSet
        RF_Mode = bRF_Mode
    
    
        return
        
        
        
    RegisterSet:
    'Inputs: bReg_Address, bReg_Value
        MRFaddr=(bReg_Address<<1)                                           'Gets register address format
        MRFConfigSel=0                                                      'Select the chip
        SHIFTOUT SDO, SCLK, 1,[MRFaddr,bReg_Value]                          'Set the register
        MRFConfigSel=1                                                      'Deselect the chip
     
        
        return
        
    RegisterRead:
    'Inputs: bReg_Address
    'Outputs: bReg_Value
        
        MRFaddr = ((bReg_Address << 1) | $40)               'Shifts left 1 bit, sets $40 bit, automatically gets start, READ, and stop bits         
        MRFConfigSel = 0                                    'Select the chip
        SHIFTOUT SDO, SCLK, 1,[MRFaddr]                     'Address to read
        SHIFTIN SDI, SCLK, 0,[bReg_Value]                   'Get data from reg
        MRFConfigSel = 1                                    'DeSelect the chip
        
        return
    Regards,
    TABSoft

  4. #4
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    Thanks, here is the update:
    Did add a var that was left out (mcparam0_read var byte) and corrected a misspell (gosub MRFInint changed to gosub MRFInit).
    Register constants (some were not changed per my interpretation of DS - BUT, I will try them later):
    Code:
    'Constants here
         RF_Init_Values[0] = $28                                                   'Standby mode, 915-928 MHz, VTune by inductors, ENABLE R1/P1/S1
    '     RF_Init_Values[0] = $68                                                   'RECEIVE mode, 915-928 MHz, VTune by inductors, ENABLE R1/P1/S1
         RF_Init_Values[1] = $8C                                                   'FSK, max IF gain, Packet Mode
         RF_Init_Values[2] = $0B                                                   '33KHz Freq Dev
         RF_Init_Values[3] = $63                                                   '2KBps
         RF_Init_Values[4] = $0C                                                   'for OOK mode, not apliable
         RF_Init_Values[5] = $03                                                   '16Bytes FIFO, 3 bytes threshold FIFO interrupt
         RF_Init_Values[6] = $77                                                   '915MHz R1 Reg
         RF_Init_Values[7] = $64                                                   '915MHz P1 Reg
         RF_Init_Values[8] = $32                                                   '915MHz S1 Reg
         RF_Init_Values[9] = $74                                                   '920MHz R2 Reg
         RF_Init_Values[10] = $62                                                  '920MHz P2 Reg
         RF_Init_Values[11] = $32                                                  '920MHz S2 Reg
         RF_Init_Values[12] = $38                                                  'config mode for OOK, not apliable
         RF_Init_Values[13] = $08                                                  'RCV:IRQ0=payload ready + IRQ1=CRC OK
                                                                                   'TX: IRQ1=TXdone
         RF_Init_Values[14] = $35                                                  'FIFO starts filling when SYNC detected,TXDONE goes hi when done,
                                                                                   'RSSI IRQ when is above level set, enable PLL lock
         RF_Init_Values[14] = $0B                                                  '
                                                                                   '
         RF_Init_Values[15] = $00                                                  'RSSI interupt level zero - minimum
         RF_Init_Values[16] = $A3                                                  'default filters config
         RF_Init_Values[17] = $38                                                  'default filters config
         RF_Init_Values[18] = $30                                                  'sync word ON, 24bits, 0 errors tolerance
         RF_Init_Values[19] = $07                                                  'reserved reg
         RF_Init_Values[20] = $00                                                  'RSII status read register, 0.5dB / bit
         RF_Init_Values[21] = $00                                                  'OOK config reg
         RF_Init_Values[22] = $53                                                  '"S" 1st byte of sync word
         RF_Init_Values[23] = $43                                                  '"C" 2nd byte of sync word
         RF_Init_Values[24] = $53                                                  '"S" 3rd byte of sync word  - my initials!
         RF_Init_Values[25] = $00                                                  '
         RF_Init_Values[26] = $70                                                  'Cutoff fcy = 200KHz, output power = 13dBm 0b000
         RF_Init_Values[27] = $BC                                                  'clk out by default 427KHz
         RF_Init_Values[28] = $03                                                  '3 bytes payload
         RF_Init_Values[29] = $01                                                  'initial MAC ADDRESS, only for test
         RF_Init_Values[30] = $5E                                                  'Fix Packet Lenght, 3 bytes preamble, whitening ON, CRC ON, Node ADDR|0x00|0xFF filtering
         RF_Init_Values[31] = $80                                                  'FIFO autocreal enable if CRC fails, Write to FIFO in stby mode 
    
    'Push all the registers to the MRF and check that each one is written correctly
         RF_STANDBY     con $20                                                    'Standby RF Mode     
         RF_SYNTHESIZER con $40                                                    'Synthesizer Mode (Test if RF Module is on and PLL Locked and working)
         RF_RECEIVER    con $60                                                    'Receive Mode
         RF_TRANSMITTER con $80                                                    'Transmit Mode
    Added your subroutines:
    Code:
    'New Subs - thanks to TABSoft
    MRFInit:'Initialize the MRF Module
                'Intial setup
                for i = 0 to 31
                    bReg_Address = i
                    bReg_Value = RF_Init_Values(i)
                    gosub RegisterSet    
                next i
                'Test the module setup
                'Clear the PLL Lock flag by setting LSTLPLL to 1
                bReg_Address = $0E                                                  'FTPRIREG
                gosub RegisterRead
                bReg_Value = bReg_Value | $02                                       'Set LSTLPLL to 1
                gosub RegisterSet                                                   'Clear the flag
        
                'Enable Synthesizer mode and test LSTSPLL stays at 1 (PLL Locked)
                bRF_Mode = RF_SYNTHESIZER
                gosub SetRFMode
    
                'Verify PLL Lock Flag
                bReg_Address = $0E                                                  'FTPRIREG
                gosub RegisterRead
                PLL_LOCK = 0
                PLL_LOCK = bReg_Value.1
                         'You can test this bit to see if PLL Is Locked
        
               'Change to Standby  
                bRF_Mode = RF_STANDBY
                gosub SetRFMode
                return
                
    Send_Packet:    
                'Set Standby mode
                bRF_Mode = RF_STANDBY
                gosub SetRFMode
        
                'Enable FIFO access in Standby mode
                bReg_Address = $1F  'Register 31
                bReg_Value = (RF_Init_Values(bReg_Address) & $BF) | $00
                gosub RegisterSet
        
                'Clear FIFO Overrun
                bReg_Address = $0D  'Register 13
                bReg_Value = (RF_Init_Values(bReg_Address) | $01)
                gosub RegisterSet
        
                'Set PLL Locked
                bReg_Address = $0E  'Register 13
                bReg_Value = (RF_Init_Values(bReg_Address) | $02)
                gosub RegisterSet
        
                For i = 0 to (TxPacketLen-1)
                'Wite the Packets to the FIFO
                wr_FIFO_Val = TxPacket[i]
                gosub WriteFIFO
                Next i 
       
                'Set RFMode to Transmit
                bRF_Mode = RF_TRANSMITTER
                gosub SetRFMode
                pause 5 'Pause 5ms
                return
    
    WriteFIFO:  'Inputs: wr_FIFO_Val
        
                MRFDataSel=0                
                SHIFTOUT SDO, SCLK, 1,[wr_FIFO_Val] 
                MRFDataSel=1                
                return
    
    SetRFMode:  ' Inputs bRF_Mode
                'SetRFMode(RF_STANDBY); (mcparam0_read & 0x1F) | RF_STANDBY) = (6E & 1F) | 20 = 2E
                bReg_Address = $00  'MCPARAM0
                gosub RegisterRead
                mcparam0_read = bReg_Value
                bReg_Value = (bReg_Value & $1F) | bRF_Mode
                bReg_Address = $00
                gosub RegisterSet
                RF_Mode = bRF_Mode
                return
    
    RegisterSet:'Inputs: bReg_Address, bReg_Value
                MRFaddr=(bReg_Address<<1)                                          'Gets register address format
                MRFConfigSel=0                                                     'Select the chip
                SHIFTOUT SDO, SCLK, 1,[MRFaddr,bReg_Value]                         'Set the register
                MRFConfigSel=1                                                     'Deselect the chip
                return
    
    RegisterRead:'Inputs: bReg_Address - Outputs: bReg_Value
                MRFaddr = ((bReg_Address << 1) | $40)                              'Shifts left 1 bit, sets $40 bit, automatically gets start, READ, and stop bits         
                MRFConfigSel = 0                                                   'Select the chip
                SHIFTOUT SDO, SCLK, 1,[MRFaddr]                                    'Address to read
                SHIFTIN SDI, SCLK, 0,[bReg_Value]                                  'Get data from reg
                MRFConfigSel = 1                                                   'DeSelect the chip
                return
    And added test code:
    Code:
    'MRF initialization here
    debug "@ MRF init", 10
    TestMRF:
                gosub MRFInit
    
    'Try to read back 1st 8 registers as a test to see if they were written correctly - remove when done debugging           
                MRFConfigSel=0                                                      'Select the chip 
                for i = 0 to 7                                                      'Sets up address to read
                    MRFaddr=((i << 1) | $40)                                       'Shifts left 1 bit, sets $40 bit, automatically gets start, READ, and stop bits
                    SHIFTOUT SDO, SCLK, 1,[MRFaddr]                                'Address to read
                    SHIFTIN SDI, SCLK, 0,[MRFSPIdata]                              'Get data from reg
                    debug "MRF Config data: i=", dec1 i, "   Register ", bin8 MRFaddr, "   Data=", hex2 MRFSPIdata,13
                next i
    
    'Try sending something
    debug "Try sending 3 bytes",13
    XMIT:       TxPacket[0] = $A1
                TxPacket[1] = $B1
                TxPacket[2] = $C1
                TxPacketLen = 3
                gosub Send_Packet
                bRF_Mode = RF_STANDBY
                gosub SetRFMode
               goto XMIT                                                          'Remark this line to be receive all the time, othewrwise its xmitting all the time
    
    RCV:        bRF_Mode = RF_RECEIVER
                gosub SetRFMode                                                    'Set to receive
    
               
    Wait4Pkt:  If MRFIrq0=1 and MRFIrq1=1 then
                  MRFDataSel=0                                                     'Select chip cuz we have a packet ready and CRC is good
                  SHIFTIN SDI, SCLK, 0,[data3]                                     'Get data from reg   
                  MRFDataSel=1                                                     'De-Select chip
                  MRFDataSel=0                                                     'Select chip cuz we have a packet ready and CRC is good
                  SHIFTIN SDI, SCLK, 0,[data2]                                     'Get data from reg  
                  MRFDataSel=1                                                     'De-Select chip
                  MRFDataSel=0                                                     'Select chip cuz we have a packet ready and CRC is good
                  SHIFTIN SDI, SCLK, 0,[data1]                                     'Get data from reg  
                  MRFDataSel=1                                                     'De-Select chip
    debug "MRF payload:  Data3=",hex2 data3,"   Data2=",hex2 data2,"   Data1=",hex2 data1,13
               endif
               goto Wait4Pkt
    But the receiver (with goto XMIT rem'd) doesn't print anything to the screen.
    Its like solving for simultaneous equations........ making an assumption (huge) that the transmitter is actually transmitting, then the problem is in the receiver.
    The SYNC is the same front and back 'SCS' so that shouldn't make a difference.
    The payload is 3 bytes......
    However, my trigger to debug the MRF is if both IRQ lines go high, my scope is telling me neither is going high so either the interrupt register is improperly configured or its not recognizing the payload.
    IF the transmitter is working.......
    See if you agree with my register values?

    Regards.
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

  5. #5
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    Looking at the PLL, so I modified the init to debug if PLL is locked"
    Code:
                'Verify PLL Lock Flag
                bReg_Address = $0E                                                  'FTPRIREG
                gosub RegisterRead
                PLL_LOCK = 0
                PLL_LOCK = bReg_Value.1
                         'You can test this bit to see if PLL Is Locked
    debug "PLL Lock=",bin1 PLL_LOCK,13
    Debug shows a '0' so its not locked..... not real sure what that means...... MC site for support on this is thin indeed.
    I can't believe no one who has read this thread has not done this, I can't believe I am the only one!
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

  6. #6
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    Well, I attempted to modify MC's Radiodriver software to match your attempts.
    Perhaps you should drop back to exactly what they are doing.
    In essence they are running in Packet mode, variable length packets with a buffer threshold of 1 packet.
    They also use a (4) byte SYNC sequence.

    Here are the register settings they use.
    Code:
         RF_Init_Values[0] = $2E                                                   'Standby mode, 915-928 MHz, VTune by inductors, ENABLE R1/P1/S1
         RF_Init_Values[1] = $84                                                   'FSK, max IF gain, Packet Mode
         RF_Init_Values[2] = $0B                                                   'Change from 200KHz Freq Dev to 33KHz Dev
         RF_Init_Values[3] = $63                                                   '2KBps
         RF_Init_Values[4] = $0C                                                   'for OOK mode, not apliable
         RF_Init_Values[5] = $C1                                                   '16Bytes FIFO, 3 Bytes threshold FIFO transmit interrupt
         RF_Init_Values[6] = $77                                                   '915MHz R1 Reg
         RF_Init_Values[7] = $64                                                   '915MHz P1 Reg
         RF_Init_Values[8] = $32                                                   '915MHz S1 Reg
         RF_Init_Values[9] = $74                                                   '920MHz R2 Reg
         RF_Init_Values[10] = $62                                                  '920MHz P2 Reg
         RF_Init_Values[11] = $32                                                  '920MHz S2 Reg
         RF_Init_Values[12] = $38                                                  'config mode for OOK, not apliable
         RF_Init_Values[13] = $C8                                                  'PLREADY, CRCOK, TXDONE, FIFO Not Full, FIFO Empty, No FIFO Overrun
                                                                                   'TX: mostly normal
         RF_Init_Values[14] = $0B                                                  '00111001
         RF_Init_Values[15] = $00                                                  '
         RF_Init_Values[16] = $41                                                  'default filters config
         RF_Init_Values[17] = $38                                                  'default filters config
         RF_Init_Values[18] = $38                                                  'sync word ON, 24bits, 0 errors tolerance
         RF_Init_Values[19] = $07                                                  'reserved reg
         RF_Init_Values[20] = $00                                                  'RSII status read register, 0.5dB / bit
         RF_Init_Values[21] = $00                                                  'OOK config reg
         RF_Init_Values[22] = $69                                                  '"S" 1st byte of sync word
         RF_Init_Values[23] = $81                                                  '"C" 2nd byte of sync word
         RF_Init_Values[24] = $7E                                                  '"S" 3rd byte of sync word  - my initials!
         RF_Init_Values[25] = $96                                                  '
         RF_Init_Values[26] = $F0                                                  'utoff fcy = 200KHz, output power = 13dBm 0b000
         RF_Init_Values[27] = $80                                                  'clk out by default 427KHz
         RF_Init_Values[28] = $40                                                  '3 bytes payload
         RF_Init_Values[29] = $00                                                  'initial MAC ADDRESS, only for test
         RF_Init_Values[30] = $E8                                                  'Fix Packet Lenght, 3 bytes preamble, whitening ON, CRC ON, Node ADDR|0x00|0xFF filtering
         RF_Init_Values[31] = $00                                                  'FIFO autocreal enable if CRC fails, Write to FIFO in stby mode     for (i = 0; i < 32; i++)
    Then alter your XMIT: to handle variable length packets.

    Code:
    'Try sending something
    debug "Try sending 3 bytes",13
    XMIT:       TxPacket[0] = $04   'Number of payload bytes + address byte
                TxPacket[1] = $00   'Hard coded address byte
                TxPacket[2] = $A1
                TxPacket[3] = $B1
                TxPacket[4] = $C1
                TxPacketLen = 5
                gosub Send_Packet
                bRF_Mode = RF_STANDBY
                gosub SetRFMode
                goto XMIT                                                          'Remark this line to be receive all the time, othewrwise its xmitting all the time
    I believe the key here is to make sure that the PLL Lock flag is setting.
    This lets you know that the Radio has turned on correctly.
    Regards,
    TABSoft

  7. #7
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    Are you using this module?
    MRF89XAM9A
    Regards,
    TABSoft

Similar Threads

  1. Interfacing LC75854
    By MR2010 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 18th July 2010, 03:42
  2. Keypad Interfacing
    By uaf5000 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th June 2010, 03:35
  3. Interfacing with the ISD4003
    By lerameur in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd June 2008, 16:25
  4. SPI Interfacing
    By toofastdave in forum Serial
    Replies: 8
    Last Post: - 18th November 2007, 12:15
  5. interfacing LCD
    By husakhalid in forum mel PIC BASIC
    Replies: 3
    Last Post: - 30th May 2006, 23:53

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts