MRF90XAM9A interfacing help


Closed Thread
Results 1 to 40 of 64

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    TABSoft, you are CORRECT, I didn't notice the 3 'special' bits. Going to steal some time and see about this today........
    More later,
    Steve
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

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


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    TABSoft-
    It took a while for me to try this (the 232 interface chip crashed so no debug data)
    What I have tried using SHIFTIN/OUT is as below:
    Code:
    [B]'MRF initialization here
    debug "@ MRF init", 10,13
                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
                next i    
                MRFConfigSel=1                                                      'Deselect the chip
                
                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
    '                MRFConfigSel=1                                                  'Deselect the chip
    '                MRFConfigSel=0                                                  'Select the chip
                    SHIFTIN SDI, SCLK, 0,[MRFSPIdata]                               'Get data from reg
                    debug "MRF Config data: Register ", hex2 MRFaddr, "   Data=", hex2 MRFSPIdata,13
                next i
                MRFConfigSel=1                                                      'Deselect the chip
    However, the data I get back is:
    @ MRF init

    MRF Config data: Register FF Data=00
    MRF Config data: Register FF Data=00
    MRF Config data: Register FF Data=00
    MRF Config data: Register FF Data=00
    MRF Config data: Register FF Data=00
    MRF Config data: Register FF Data=00
    MRF Config data: Register FF Data=00
    MRF Config data: Register FF Data=00

    Its got to be staring at me, but I just can't see it..........
    "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

    Give this a shot.

    Code:
    [B]'MRF initialization here
    debug "@ MRF init", 10,13
    '            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      
                    MRFConfigSel=0                                                      'Select the chip       
    '                SHIFTOUT SDO, SCLK, 1,[MRFaddr,RF_Init_Values[i]]               'send data to register
                    SHIFTOUT SDO, SCLK, 1,[MRFaddr,RF_Init_Values(i)]               'send data to register
                    MRFConfigSel=1
                next i    
    '            MRFConfigSel=1                                                      'Deselect the chip
                
    '            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
                    MRFaddr=((i << 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
    '                MRFConfigSel=1                                                  'Deselect the chip
    '                MRFConfigSel=0                                                  'Select the chip
                    SHIFTIN SDI, SCLK, 0,[MRFSPIdata]                               'Get data from reg
                    MRFConfigSel=1    
                    debug "MRF Config data: Register ", hex2 MRFaddr, "   Data=", hex2 MRFSPIdata,13
                next i
    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

    I did find the double 'OR' but it didn't seem to help.
    I also remarked the chip selects and deselects - no help either.
    Thanks though for trying!

    The code in the next post is where I am now, but, its confusing when you can't read the register to know if its set, then, transmission to a ZENA
    sniffer I found on another board said that it is useless if you are not using MiWi......
    Ugh!
    "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

    I think, with no certainty, that reading the part has to be done using hardware SPI in full-duplex mode. I don't see any way to SHIFTIN to send the address, and then SHIFTOUT to get the data accurately.
    I used hardware SPI (simplex) on a different project and it worked great, but I wasn't trying to write and read simultaneously.

    Has anyone had any luck using hardware SPI in a full-duplex project?
    If so, any help would be appreciated - maybe that is what I need to do?

    Regards
    "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

    Perhaps you need to strip this back to the basics?
    Forget trying to configure the MRF registers.
    Just try to read them after a POR.
    Also, what is your physical connectivity between the PIC and the MRF (Pinouts/Schematic)?
    Can you show us your aliases for MRFConfigSel, SCLK, SDO and SDI?
    I can't think of any reason why you shouldn't be able to read the config registers.
    Using Shiftin/Shiftout for SPI has not been a problem thus far.


    Create just a skeleton program to configure the PIC for the connectivity you need to the MRF and Serial port for debug.
    Then with the skeleton, just wait for the appropriate amount of time and try to read regs 00 - 07, but do not do this in a For/Next loop. Read each register in a serial fashion.

    E.g.
    MRFaddr = $40
    MRFConfigSel = 0
    SHIFTOUT SDO, SCLK, 1,[MRFaddr]
    SHIFTIN SDI, SCLK, 0,[MRFSPIdata]
    MRFConfigSel = 1
    debug "MRF Config data:Register ", bin8 MRFaddr, " Data=", hex2 MRFSPIdata,13
    pause 50
    MRFaddr = $41
    MRFConfigSel = 0
    SHIFTOUT SDO, SCLK, 1,[MRFaddr]
    SHIFTIN SDI, SCLK, 0,[MRFSPIdata]
    MRFConfigSel = 1
    debug "MRF Config data:Register ", bin8 MRFaddr, " Data=", hex2 MRFSPIdata,13
    pause 50

    etc...
    Regards,
    TABSoft

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


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    Thanks for the continued interest - I will share code with all when the darn thing works <grin>.
    the IO assignments below:
    Code:
            MRFReset        var PORTA.1                                             'MRF module reset
            MRFDataSel      var PORTA.4                                             'MRF module serial interface data chip select, active LOW
            MRFConfigSel    var PORTA.5                                             'MRF module serial interface configure chip select, active LOW
            MRFIrq0         var PORTB.0                                             'MRF module interupt 0
            MRFIrq1         var PORTC.2                                             'MRF module interupt 1
    I have the time to work on this now (at home) so I will try just readinga register back - no loops.
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

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


    Did you find this post helpful? Yes | No

    Default Re: MRF90XAM9A interfacing help

    I've found a few things, I 'think' the registers are being set correctly, but I cannot read back from it.
    I just don't get the full-duplex SPI in this case.
    New code and debug data below:
    Register constants:
    Code:
    'Constants here
         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] = $01                                                   '200KHz 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 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] = $00                                                  'interrupts by default
         RF_Init_Values[14] = $19                                                  '00011001
         RF_Init_Values[15] = $00                                                  '
         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] = $00                                                  '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] = $59                                                  '"Y" 2nd byte of sync word
         RF_Init_Values[24] = $44                                                  '"D" 3rd byte of sync word
         RF_Init_Values[25] = $00                                                  '
         RF_Init_Values[26] = $70                                                  'utoff fcy = 200KHz, output power = 13dBm 0b000
         RF_Init_Values[27] = $BC                                                  'clk out by default 427KHz
         RF_Init_Values[28] = $02                                                  '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] = $00                                                  'FIFO autocreal enable if CRC fails, Write to FIFO in stby mode
    and the new code for writing to the part:
    Code:
    '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 the 1st 8 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
                MRFConfigSel=1                                                      'Deselect the chip
    Then I try to send 3 bytes:
    Code:
    '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
               
    XMIT_STDBY:i=0                                                                 'Register of interest
               MRFaddr=(i<<1)                                                      'Gets register address format
               MRFConfigSel=0                                                      'Select the chip
               SHIFTOUT SDO, SCLK, 1,[MRFaddr,$28]                                 'send data, STANDBY, 915-928, Vtune by tank caps, Enable R1 P1 S1
               MRFConfigSel=1                                                      'Deselect the chip
    and the debug data:
    Code:
    @ MRF init
    Addr=00000000  Value=28
    Addr=00000010  Value=8C
    Addr=00000100  Value=01
    Addr=00000110  Value=63
    Addr=00001000  Value=0C
    Addr=00001010  Value=03
    Addr=00001100  Value=77
    Addr=00001110  Value=64
    Addr=00010000  Value=32
    Addr=00010010  Value=74
    Addr=00010100  Value=62
    Addr=00010110  Value=32
    Addr=00011000  Value=38
    Addr=00011010  Value=00
    Addr=00011100  Value=19
    Addr=00011110  Value=00
    Addr=00100000  Value=A3
    Addr=00100010  Value=38
    Addr=00100100  Value=30
    Addr=00100110  Value=00
    Addr=00101000  Value=00
    Addr=00101010  Value=00
    Addr=00101100  Value=53
    Addr=00101110  Value=59
    Addr=00110000  Value=44
    Addr=00110010  Value=00
    Addr=00110100  Value=70
    Addr=00110110  Value=BC
    Addr=00111000  Value=02
    Addr=00111010  Value=01
    Addr=00111100  Value=5E
    Addr=00111110  Value=00
    MRF Config data: i=0   Register 01000000   Data=00
    MRF Config data: i=1   Register 01000010   Data=00
    MRF Config data: i=2   Register 01000100   Data=00
    MRF Config data: i=3   Register 01000110   Data=00
    MRF Config data: i=4   Register 01001000   Data=00
    MRF Config data: i=5   Register 01001010   Data=00
    MRF Config data: i=6   Register 01001100   Data=00
    MRF Config data: i=7   Register 01001110   Data=00
    Try sending 3 bytes
    I got my ZENA sniffer but it does not pick up anything in RAW sniffer mode........
    How can I check to see if it transmits correctly when I don't know if I can read the registers or see if it transmits?

    -Stuck in RF bleakness......
    "If we knew what we were doing, it wouldn't be called research"
    - Albert Einstein

Similar Threads

  1. Interfacing LC75854
    By MR2010 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 18th July 2010, 02:42
  2. Keypad Interfacing
    By uaf5000 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th June 2010, 02:35
  3. Interfacing with the ISD4003
    By lerameur in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd June 2008, 15:25
  4. SPI Interfacing
    By toofastdave in forum Serial
    Replies: 8
    Last Post: - 18th November 2007, 11:15
  5. interfacing LCD
    By husakhalid in forum mel PIC BASIC
    Replies: 3
    Last Post: - 30th May 2006, 22: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