Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
hi guys,the Cypress CYRF6936 is a modern 2.4 GHz Direct Sequence Spread Spectrum (DSSS) radio transceiver. it's very versatile and available in pre built module form suitable for interfacing to microcontrollers from a few vendors.i've been using them in my latest radio control system.when i first started working with the CYRF6936 i was surprised how little information there was online about how to get an initial test setup working.i know there are people on here with an interest in this (and other) RF transceivers.with this in mind i present the following page:http://sites.google.com/site/mrdunk/interfacing-cypress-cyrf6936-to-avr-microcontrollersdunk.
I wasn't satisfied with the IC communication... too complicated to operate... really...
It was the lack of functionality it showed as an IC design...
My university is developing some ZigBee devices
Are you so interested in one IC only or you just need a solution on the 2.4GHz???
aaahhh.... my english....
But isn't it better if you have a "surelink" between 2 or more devices???
Hey dunk did you have to set the register again after each transmit/reception and generally
' --------[ Device Config]----------------------------------------------------$regfile = "m8535.dat"$crystal = 16000000$baud = 9600' --------[ LCD Config ]------------------------------------------------------Config Lcdpin = Pin , Db4 = Portc.3 , Db5 = Portc.2 , Db6 = Portc.5Config Lcdpin = Pin , Db7 = Portc.4 , E = Portc.1 , Rs = Portc.0Config Lcd = 20 * 4' --------[ SPI Config ]------------------------------------------------------Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 1 , Clockrate = 16 , Noss = 1' --------[ General Port Config ]---------------------------------------------Config Portb = OutputConfig Portb.2 = Input' --------[ Port Sympolic Name ]----------------------------------------------Resetline Alias Portb.0Ss Alias Portb.4' --------[ Constants ]-------------------------------------------------------Const Reg_id = &H00Const Reg_control = &H03Const Reg_data_rate = &H04Const Reg_config = &H05Const Reg_serdes_ctl = &H06Const Reg_rx_int_en = &H07Const Reg_rx_int_stat = &H08Const Reg_rx_data_a = &H09Const Reg_rx_valid_a = &H0AConst Reg_rx_data_b = &H0BConst Reg_rx_valid_b = &H0CConst Reg_tx_int_en = &H0DConst Reg_tx_int_stat = &H0EConst Reg_tx_data = &H0FConst Reg_tx_valid = &H10Const Reg_pn_code = &H11Const Reg_threshold_l = &H19Const Reg_threshold_h = &H1AConst Reg_wake_en = &H1CConst Reg_wake_stat = &H1DConst Reg_analog_ctl = &H20Const Reg_channel = &H21Const Reg_rssi = &H22Const Reg_pa = &H23Const Reg_crystal_adj = &H24Const Reg_vco_cal = &H26Const Reg_pwr_ctl = &H2EConst Reg_carrier_detect = &H2FConst Reg_clock_manual = &H32Const Reg_clock_enable = &H33Const Reg_syn_lock_cnt = &H38Const Reg_mid = &H3C' --------[ Variables ]-------------------------------------------------------Dim Brust As BitDim Rw_select As BitDim Address As ByteDim Carrier(8) As ByteDim Rssi_sample As ByteDim Channel As ByteDim I As Byte , J As ByteDim Bytenum As ByteDim Sum As Word' --------[ Initialize ]------------------------------------------------------Resetline = 1' Set reset line to logic high to enable the ICSs = 1' Set SS line to logic high to avoid data floatBrust = 0Rw_select = 0Address = 0For I = 1 To 8 Carrier(i) = 0Next' Set everything variable to zero to avoid possible float' LCD messagingClsCursor OffLcd " CYWUSB6935 Report "' Initialize SPISpiinit' --------[ Main Program ]----------------------------------------------------DoJ = 1For Channel = 20 To 39 Gosub Channel_set Gosub Rssi Locate 2 , J : Lcd Rssi_sample ; " " J = J + 2NextWaitms 100LoopEnd ' End' --------[ SubRoutines ]-----------------------------------------------------Address_up:' Check for Brust SPI mode If Brust = 1 Then Address = Address + 64 End If' Check for Read/Write sequence' If 0 then Read command is issued' If 1 then Write command is issued If Rw_select = 1 Then Address = Address + 128 End IfReturn ' ReturnSpi_read:' Read the device Ss = 0' Set SS line low since it's disabled from the hardware SPI Spiout Address , 1' Send the address to the CYWUSB6935' Note that the command bits 6 and 7 are controller via the' Address_up subroutine Spiin Carrier(1) , Bytenum' Read what is sent to the AVR' The number of bytes received is determined by Bytenum variable Ss = 1' Set SS line to logic high and stop any transactionReturn ' ReturnSpi_write:' Write to the device Ss = 0' Set SS line low since it's disabled from the hardware SPI Spiout Address , 1' Send the address to the CYWUSB6935' Note that the command bits 6 and 7 are controller via the' Address_up subroutine Spiout Carrier(1) , Bytenum' Write some bytes to the device' The number of bytes sent is determined by Bytenum variable Ss = 1' Set SS line to logic high and stop any transactionReturn ' ReturnGet_pn_code:' Reading the PN Code' Set the variables for "PN Code" register reading Brust = 1' Brust = 1 because we read 8 bytes in one circle Rw_select = 0' We READ the pn code Bytenum = 8' Eight bytes to read Address = Reg_pn_code' See constant table above' Issue everything needed to read the device' and the certain register Gosub Address_up Gosub Spi_read' LCD messaging Lowerline Lcd "PN: " For I = 8 To 1 Step -1 Lcd Hex(carrier(i)) Next Return 'ReturnRead_analog_contol:' Reading the analog control register' Set the variables for this task Brust = 0' Only one byte to read Rw_select = 0' We READ the analog control register Bytenum = 1' One byte to read Address = Reg_analog_ctl' See constant table above' Issue everything needed to read the device' and the certain register Gosub Address_up Gosub Spi_read' LCD messaging Thirdline Lcd "An Cont: " ; Bin(carrier(1))ReturnWrite_analog_contol:' Writing to the analog control register' Set the variables for this task Brust = 0' Only one byte to write Rw_select = 1' We WRITE the analog control register Bytenum = 1' One byte to read Address = Reg_analog_ctl' See constant table above' Issue everything needed to read the device' and the certain register Gosub Address_up Gosub Spi_writeReturn ' returnRead_carrier_detect:' Reading the carrier control register' Set the variables for this task Brust = 0' Only one byte to read Rw_select = 0' We READ the analog control register Bytenum = 1' One byte to read Address = Reg_carrier_detect' See constant table above' Issue everything needed to read the device' and the certain register Gosub Address_up Gosub Spi_read' LCD messaging Fourthline Lcd "Car Det: " ; Bin(carrier(1))Return ' ReturnWrite_carrier_detect:' Writing to the carrier control register' Set the variables for this task Brust = 0' Only one byte to write Rw_select = 1' We WRITE the analog control register Bytenum = 1' One byte to read Address = Reg_carrier_detect' See constant table above' Issue everything needed to read the device' and the certain register Gosub Address_up Gosub Spi_writeReturn ' ReturnChannel_set:' Writing to the channel register' Set the variables for this task Brust = 0' Only one byte to write Rw_select = 1' We WRITE the channel register Bytenum = 1' One byte to write Address = Reg_channel' See constant table above Carrier(1) = Channel' The byte sent is the Channel number setted above' Issue everything needed to read the device' and the certain register Gosub Address_up Gosub Spi_writeReturn ' ReturnRssi:' Receive Signal Strength Indicator' First access analog control to permit writing to' the carrier detect register.' In this register we enable the receiver of the IC Carrier(1) = &B01000000' Set Reg Write Control to 1 Gosub Write_analog_contol Sum = 0 For I = 1 To 20 Gosub Receive_mode_on Brust = 0 ' Only one byte to write Rw_select = 0 ' We READ the RSSI register Bytenum = 1 ' One byte to read Address = Reg_channel ' See constant table above Gosub Address_up Gosub Spi_read If Carrier(1) < 32 Then Carrier(1) = &B10000000 Gosub Write_carrier_detect Waitus 55 Brust = 0 ' Only one byte to write Rw_select = 0 ' We READ the RSSI register Bytenum = 1 ' One byte to read Address = Reg_channel ' See constant table above Gosub Address_up Gosub Spi_read Carrier(1) = Carrier(1) - 32 Sum = Sum + Carrier(1) Carrier(1) = &B00000000 Gosub Write_carrier_detect Else Carrier(1) = Carrier(1) - 32 Sum = Sum + Carrier(1) End If Gosub Receive_mode_off Next Rssi_sample = Sum / 20Return ' ReturnReceive_mode_on: Carrier(1) = &B10000000 ' Set the variables for this task Brust = 0 ' Only one byte to write Rw_select = 1 ' We WRITE the channel register Bytenum = 1 ' One byte to read Address = Reg_control ' See constant table above Gosub Address_up Gosub Spi_writeReturn 'ReturnReceive_mode_off: Carrier(1) = &B00000000 ' Set the variables for this task Brust = 0 ' Only one byte to write Rw_select = 1 ' We WRITE the channel register Bytenum = 1 ' One byte to read Address = Reg_control ' See constant table above Gosub Address_up Gosub Spi_writeReturn 'Return