SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By ric
#6955
I’m having problems with the configuration of the transceivers.

I use the pic 16f876 for communicate with the transceivers trough a protocol SPI created by me (this protocol has been proved and it works).

The first prove that I want to do is to send a byte, so I configure one of them transceiver as a transmissor and the other as a receiver.

The configuration word of the transmissor is 08 08 00 00 00 00 00 00 00 00 00 00 23 4F 14. Once the circuit has been loaded we have to wait 100 ms, to put the transceiver in program mode (CE=0 and CS=1). After this we send the configuration Word and we put the transmisor in active mode (CE=1 y CS=0) sending 01 address and 31 data to the transceiver that we want to use as receiver and then we put it in stand by mode.

The second transceiver has the following configuration Word 08 08 00 00 00 00 01 00 00 00 00 01 23 4F 15 (as we can see the address of this transceiver is 01). After the configuration we put the receiver in active mode and the DR1 never gets active.

Please help me with this problem.
By ric
#6981
please somebody help me with my problem, I am 2 weeks trying to make the configuration and I do not obtain result
By Lajon
#6986
You could start trying to get some activity on the DR1 pin. So forget about the sender for a while and configure with no CRC. The noise that is picked up should make the DR1 active.

Have you verified the timing - for example
to put the transceiver in program mode (CE=0 and CS=1).

is not enough there should be a 5 microsecond delay before data is sent.
Also, the fastest possible SPI clock is I belive 1MHz (you need 500ns setup and hold time and also 500ns high time for the clock). What speed are you using?

/Lars
By ric
#6987
thank you very much by the answer, it makes the test as you said (without CRC) but does not activate the DR1 yet, I believe that the problem is in the configuration and I ask to you that you explain to me as you make the configuration.

the time that exists between the configuration and data send is more that 1 second and SPI protocol it is emulated and it has a frequency of 100kHz.

please help me with my problem.
By pittuck
#6990
what frequency is your PIC and can we see the code for the sending the config.

I cannot go though the config at the moment as it takes ages. But as soon as i get some time i will.
By Lajon
#6992
ric, I had a look at the configuration data and it looks ok.
is not enough there should be a 5 microsecond delay before data is sent.
I should clarify that - you need to wait 5 micros before sending the configuration data. Maybe you should be ok with this since your SPI clock is only 100KHz.

I agree with pittuck, show the code and maybe some PIC expert (I am not one) will spot some problem.

/Lars
By ric
#6995
thanks pittuck and lajon, now I send de code that I usin for configurate de transceiver.

list p=16f876
include<p16f876.inc>

org 0x00
goto inicio

org 0x04
goto inter

;///////////declaracion de variables//////////7777777

retar_20 equ 0x30
retar1_20 equ 0x31
retar equ 0x32
retar1 equ 0x33
retaro equ 0x34
retar1o equ 0x35
cont equ 0x36
temp1 equ 0x37
temp2 equ 0x38
var equ 0x39
veinte equ 0x3A

dato_raml equ 0x39
dato_ramh equ 0x3A



W_Temp equ 7Ch
Status_Temp equ 7Dh
PClatch_Temp equ 7Eh
FSR_Temp equ 7Fh


;configuracion de registros
inicio

call iniciar_puertos
call iniciar_perifericos
call iniciar_variables
goto principal


;programa principal

principal

call retardo_20
call retardo_20
call retardo_20
call retardo_20
call conf_RF
goto $

;/////////////////interrupciones/////////////

inter

movwf W_Temp
swapf STATUS,w
clrf STATUS ;guarda STATUS
movwf Status_Temp
movf PCLATH,w
movwf PClatch_Temp ;guarda PCLATH
clrf PCLATH
movf FSR,w
movwf FSR_Temp ;guarda FSR

;///////////////////verifica a q interrupcion ir//////////////



btfsc INTCON,INTF ;ve si es la interrupcion externa
goto interext ;va a la interrupcion externa



;//////////////////salida de las interrupciones///////////

fininter

movf FSR_Temp,w
movwf FSR ;reestablece FSR
movf PClatch_Temp,w
movwf PCLATH ;restablece PCLATH
swapf Status_Temp,w
movwf STATUS
swapf W_Temp,f
swapf W_Temp,w ;restablece w

retfie



;////////////////////////interrupcion externa////////////////

interext

bcf INTCON,INTF

bsf PORTA,3 ;habilita CE
bcf PORTA,4 ;limpia CS


nop
movlw 0xAA
call env_spi
movlw 0xBB
call env_spi
movlw 0xCC
call env_spi
movlw 0xDD
call env_spi
movlw 0xEE
call env_spi ;manda la direccion

movlw 0x31
call env_spi
movlw 0x32
call env_spi
movlw 0x33
call env_spi
movlw 0x34
call env_spi ;manda el dato



bcf PORTA,3 ;limpia CE
bcf PORTA,4 ;limpia CS


goto fininter







;/////////////////////rituna q inicializa los puertos/////////////////////

iniciar_puertos

bcf STATUS, RP0 ;va al banco 0

clrf PORTA
clrf PORTB
clrf PORTC
;clrf PORTD
;clrf PORTE

bsf STATUS, RP0 ;va al banco 1

movlw b'00000111' ;RA0,RA1,RA2,RA3,RA4,RA5,RE0,RE1,RE2 digitales
movwf ADCON1 ;Mover el valor al registro
movlw b'00000100' ;0,1,2,3 entradas 4 salida
movwf TRISA

movlw b'00000001' ;0,1,2,3 entradas 4,5,6,7 salidas
movwf TRISB

movlw b'10011011' ;0,1,2,3,4,5,6 salidas 7 entrada
movwf TRISC

;movlw b'00000000' ;0,1,2,3,4,5,6,7 salidas entrada
;movwf TRISD

;movlw b'00000000' ;0,1,2,3,4,5,6,7 salidas entrada
;movwf TRISE
bcf STATUS,RP0

return

;/////////////////////rituna q inicializa los perifericos/////////////////////


iniciar_perifericos

bsf STATUS,RP0 ;seleccion del banco 1
movlw b'00100000'
movwf PIE1 ;permiso de interrupciones para el T1 y T2
movlw b'00110011'
movwf SPBRG ;indica q la transmision serial se realiza a 9600 baudios
bsf TXSTA,TXEN
bsf TXSTA,BRGH

bcf STATUS,RP0 ;va al banco 0
movlw b'11010000'
movwf INTCON
bsf RCSTA,CREN
bsf RCSTA,SPEN


clrf STATUS
clrf PIR1
clrf PIR2

return

;/////////////////////rituna q inicializa las variables/////////////////////


iniciar_variables

bcf STATUS,RP0 ;va al banco 0

movlw 0x0A
movwf retar1

movlw 0x03
movwf retar

clrf temp1
clrf temp2
clrf cont
clrf var
clrf veinte

bcf PORTA,3
bcf PORTA,1

clrf dato_raml
clrf dato_ramh

return

;///////////////////////rutina de transmision serial///////////
enviar
movwf TXREG
bcf PIR1,TXIF
bsf STATUS,RP0
bcf STATUS,RP1
fintx
btfss TXSTA,TRMT
goto fintx
bcf STATUS,RP0
bcf STATUS,RP1
retardo_mas
decfsz retar
goto retardo_mas
movlw 0x03
movwf retar
decfsz retar1
goto retardo_mas
movlw 0x0A
movwf retar1
return

;///////////////////retardo de 20ms/////////7
retardo_20

retardo22
decfsz retar_20
goto retardo22
movlw 0xFF
movwf retar_20
decfsz retar1_20
goto retardo22
movlw 0x50
movwf retar1_20
return

;///////////////////retardo de 5ms/////////7
retardo_5

retardoo
decfsz retaro
goto retardoo
movlw 0xFF
movwf retaro
decfsz retar1o
goto retardoo
movlw 0x02
movwf retar1o
return

;/////////////////////////espera q llegue dato spi//////////
esp_spi


movlw 0x08
movwf temp2 ;Inicializa el contador
nop
nop
nop
nop
bck_spi

bsf PORTA,1 ;coloca reloj en estado alto


bsf STATUS,C
btfss PORTA,2 ;Copia el valor del dato en el carry
bcf STATUS,C

nop
nop
nop
nop

bcf PORTA,1 ;coloca reloj en estado bajo
rlf temp1,f ;Para guardarlo en el temporal

decfsz temp2,f ;Comprobamos el contador, para ver si hemos recibido los 8 bits
goto bck_spi ;Si no, se repite el ciclo
movf temp1,w
call enviar
return

;////////////////////enviar dato spi////////
env_spi

movwf temp1 ;Salva el byte a transmitir en el registro temporal 'temp1'
movlw 0x08
movwf temp2 ;Inicializa el contador
vuelve_spi
bsf PORTA,0 ;coloca dati en 1
btfss temp1,7 ;Comprueba el bit
bcf PORTA,0 ;y lo coloca la salida en 0 si el dato es 0
nop ;Envia el bit
nop
bsf PORTA,1
nop ;Da un pulso de reloj
nop
nop
nop
bcf PORTA,1
nop
rlf temp1,f ;Rotamos a la izquierda 'temp1'
decfsz temp2,f ;Comprobamos el contador, para ver si hemos enviado los 8 bits
goto vuelve_spi ;Si no se repite el ciclo
bcf PORTA,0


return
;/////////////////////////7configura en trw 24g////////////////////
conf_RF

bcf PORTA,3 ;limpia CE
bsf PORTA,4 ;habilita CS

nop

movlw 0x00
call env_spi
movlw 0x20
call env_spi
movlw 0x00
call env_spi
movlw 0x00
call env_spi
movlw 0x00
call env_spi
movlw 0x00
call env_spi
movlw 0x00
call env_spi
movlw 0xAA
call env_spi
movlw 0xBB
call env_spi
movlw 0xCC
call env_spi
movlw 0xDD
call env_spi
movlw 0xEE
call env_spi
movlw 0xA2
call env_spi
movlw 0x4C
call env_spi
movlw 0x04
call env_spi


bcf PORTA,3 ;limpia CE
bcf PORTA,4 ;limpia CS




return






;/////////////////////////////incluye la libreria/////////////////////////////

end


that is de code please someone help me with my problem I apreeciate so much your colaboration.
By ric
#7147
somebody exists that programs pic in assembler and has handled trw-2.5g, please help me I have been a month trying that this transceiver works
By calvete
#7200
ric wrote:somebody exists that programs pic in assembler and has handled trw-2.5g, please help me I have been a month trying that this transceiver works
Hello ric, Excuseme for me english by is not my native languaje.
i am not a pic assembler expert. I programming pic in C languaje. I have a pic 16f876 and connected to TRF-2.4 sucessful.

Pic16f876 is 5 volt and module TRF 2.4 is 3.6 volt max.
How is your interface? my interface is with volt divider resistor from pic to TRF and direct from TRF to Pic.
From power 5 volt i used 1 diode 1N4007 to pic (pin 20) and 2 diode from pic (pic 20) to TRF 2.4G.