CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

ADF7012
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kmp84



Joined: 02 Feb 2010
Posts: 363

View user's profile Send private message

ADF7012
PostPosted: Thu Dec 26, 2024 3:25 am     Reply with quote

Hello,

I'm working with Analog Devices ADF7012 dig.transmitter and have question:

1.Is that is right SPI config:
Code:


#include <18F2420.h>
#FUSES NOWDT                    //No Watch Dog Timer
#use delay(crystal=16384kHz)


#define ADF7012_PIN_CLK     PIN_C1 //o
#define ADF7012_PIN_MOSI    PIN_C2 //o
#define ADF7012_LE          PIN_C0 //o

#use spi(MASTER, DO=ADF7012_PIN_MOSI, BITS=32, CLK=ADF7012_PIN_CLK, LOAD=ADF7012_LE, MSB_FIRST, MODE=0, baud=1000000)

#define ADF_REG0 0x408000UL
#define ADF_REG1 0x1ABD51UL     
#define ADF_REG2 0x196C2UL
#define ADF_REG3 0x4055A09FUL

void Init_ADF7012(void){
   spi_xfer(ADF_REG0);
   spi_xfer(ADF_REG1);
   spi_xfer(ADF_REG2);
   spi_xfer(ADF_REG3);
}

void main()
{
   unsigned int16 i;
   
   delay_ms(300);
   
   Init_ADF7012();
   
   while(TRUE)
   {

   }
}



With this test example code get the configured out clock on "CLK out" but have no RF output signal. Is this the correct data transfer like 32 bits or not?

Best Regards,
Kriss
temtronic



Joined: 01 Jul 2010
Posts: 9257
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 7:28 am     Reply with quote

Ah, the Classic 5 volt PIC and 3 volt peripheral !!!

You cannot direct connect them, they need a logic level translation device in between them.

First you need to get the hardware correct THEN code as required.....

Since 99.44% of all peripherals today are 3 volts, consider using a 3 volt rated PIC, allows direct connection

If not an option, logic level translators ARE required,as a 3 volt 'high' isn't high enough ( usually min 4 volts). would have to read the datasheet, as not all PICs were created equal !
kmp84



Joined: 02 Feb 2010
Posts: 363

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 7:46 am     Reply with quote

Hi,
I have no trouble with hardware it's working correct. The problem are in software. I have 3v3 to 5 v level shifters.
Ttelmah



Joined: 11 Mar 2010
Posts: 19573

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 8:49 am     Reply with quote

You don't show any code controlling the CE pin.
This presumably is tied to 3.3v?.
If so, you need to wait a short time after power on, before programming
the chip. The PIC wakes faster than this does.
None of the examples show the ClkOut div ratio being programmed
with 0 as you do. This is not actually a legal value for this register.
Start by doing some defines for the individual registers, with the values
for these, and OR these together to make the values to send. If you
give these names, it'll document what you are trying to set the registers
actually to.
Now the chip needs a data input as well for what is to be sent. Have you got
this pin actually connected to something?.
What frequency are you trying to work at?. What component values have
you got for the loop filter, oscillator etc.?.
kmp84



Joined: 02 Feb 2010
Posts: 363

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 9:28 am     Reply with quote

Hi mr.TT,

Yes CE pin connected to VDD 3v3. I have 300ms startup delay before init.
I'm using Analog Devices Config tool to get register values. Crystal freq = 16.384Mhz which are connected to pic and ADF7012 over 74hc00 buffer.

TxData pin4 on ADF7012 connected to PIN_C3 and trying to send serial async. data with baud 1200. I have checked all signals that comming to ADF IC with scope.

On 'CLK_ou't pin10 get the congigured clock = 1.02Mhz

Config Setting: https://easyupload.io/2yik1w

Best Regards,
Ttelmah



Joined: 11 Mar 2010
Posts: 19573

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 11:03 am     Reply with quote

Hmm.
I must admit, the fact it is generating the clock, suggests it is programming
OK, which strongly hints there is a hardware problem somewhere. I would
first of all verify that the serial data is actually present at the chip's input,
and is the correct voltage levels for the chip. Something silly like a solder
short is all too easy.
Then the actual synthesis of the output, is dependant on the Vco. So a
fault with the Cvco connection, or the L1/L2 connections would give the
behaviour you are seeing. Also the connection from Cpout, to VCOin.
It sounds as if the actual synthesiser is running, but not the RfVCO.
Rf design requires careful part selection. Some capacitors have a lot more
inductance than you would want here, and many inductors a lot more
capacitance. Are you using the recommended inductor for the frequency
chosen?.


Last edited by Ttelmah on Thu Dec 26, 2024 11:11 am; edited 1 time in total
kmp84



Joined: 02 Feb 2010
Posts: 363

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 11:09 am     Reply with quote

My general question was is this SPI port setting ar OK? Also "LOAD=ADF7012_LE" in spi setuo ok?
Ttelmah



Joined: 11 Mar 2010
Posts: 19573

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 11:17 am     Reply with quote

Potentially, yes. However personally I would control the load pin myself.
I would not be confident that the default clocking of load, would wait
till after the falling edge of the clock. Since the SPI is clocking the data
on the rising edges.
However if there was a fault with the transfers, you would not be getting
the specified frequency. It really does 'smell' of a hardware problem
with something in the RF part.
kmp84



Joined: 02 Feb 2010
Posts: 363

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 12:22 pm     Reply with quote

Ok, Mr."Tt" Thanks for suggestions.
I can get the second board for testing and will write after that. But for me it 'smell' of a software problem . Shocked

Best Wishes,
Ttelmah



Joined: 11 Mar 2010
Posts: 19573

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 12:52 pm     Reply with quote

Are you sure about the component values around the RF for the frequency
you are using?. What is the frequency you are working with?.
kmp84



Joined: 02 Feb 2010
Posts: 363

View user's profile Send private message

PostPosted: Thu Dec 26, 2024 1:15 pm     Reply with quote

Hi,

Yes this is complete working boards from 400 to 470 Mhz.
kmp84



Joined: 02 Feb 2010
Posts: 363

View user's profile Send private message

PostPosted: Sat Dec 28, 2024 1:15 pm     Reply with quote

Hi,

Now ADF7012 working. The problem was bad address of ADF_REG2.

With this settings:

Code:

#define ADF_REG0 0x2404000UL
#define ADF_REG1 0xd36d1UL   
#define ADF_REG2 0x19102aUL   
#define ADF_REG3 0x55a09fUL


ADF7012 transmitter configured as FSK modulation at 433.00 Mhz.
I'm not sure but all data may can be transferred as 8bit not 32bit.?

Best Wishes,
Ttelmah



Joined: 11 Mar 2010
Posts: 19573

View user's profile Send private message

PostPosted: Sun Dec 29, 2024 4:09 am     Reply with quote

The hardware can only send eight bits at a time. Yes, but makes no difference
the #USE SPI if configured to send 32bits, sends 4*8 bits. The clock time
between the 8th and 9th bit, (and 16th/17th etc.)(, is slightly longer as the
next value is loaded, but the compiler sends 32bits. Since SPI is synchronous,
the change in clock rate does not matter at all.
You really should use LL, not L, however the compiler will detect the value
is too large to fit into a 'long' and should automatically switch to LL.
kmp84



Joined: 02 Feb 2010
Posts: 363

View user's profile Send private message

PostPosted: Sun Dec 29, 2024 5:20 am     Reply with quote

Hi mr."Tt".

Quote:

You really should use LL, not L, however the compiler will detect the value
is too large to fit into a 'long' and should automatically switch to LL.

You mean "UL" suffix for register def.?

Now I faced another problem with generating TPL tone squelch because the data receiver has TPL tone squelch and can not transmit data before generating a real TPL tone 79.7Hz. I tried to generate a rectangular signal with period 12.54ms but it doesn't work.

Best Regards,
Ttelmah



Joined: 11 Mar 2010
Posts: 19573

View user's profile Send private message

PostPosted: Sun Dec 29, 2024 10:11 am     Reply with quote

No, I mean LL.
Or, use an explicit cast to int32.
The big advantage of that is it becomes compiler independent.

The point is the default types in PCB, PCM & PCH, are that an int is 8bits,
and a 'long' int is 16 bits. LL is the abbreviation for a long long. 32bits
in these compilers.
By default the types are unsigned.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group