| View previous topic :: View next topic |
| Author |
Message |
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Tue Oct 23, 2007 2:49 pm |
|
|
The cc1000 i am using is conected to a pic16f886 and the tc and rx pins of the pic is not used. The pins used for coms is DCLK,DIO,PSEL,PCLK,PDO,PDI the software for the design is available at
http://www.mohag.net/ccscc1000code
Please have a look at the code as that might give some insight as to my need.
The board is a standard design that is designed by one of the Professors that is specifically used for our 3rd year project. |
|
 |
newguy
Joined: 24 Jun 2004 Posts: 1946
|
|
Posted: Wed Oct 24, 2007 9:16 am |
|
|
I had a look at the CC1000's data sheet. If it's possible for you to connect this transceiver's DIO and DCLK to the PIC's USART (usually pins C6 and C7), then you just have to program the CC1000 to use the "Transparent Asynchronous UART Mode" first referenced on pg 16 of the datasheet. Using that mode will allow you to employ the simple interface/rx routine I mentioned.
If this is not possible, then the other 2 transceiver modes possible with this chip hinge on you monitoring the CC1000's DCLK line and properly recording the state of the DIO line on the rising edge of the DCLK. It's then up to you to then properly sort this data into bytes. Once that is done, then the same algorithm in the post I mentioned before can be used to decode the received data.
As to properly setting up the internal registers of the CC1000 for whatever operation you wish, follow the data sheet. |
|
 |
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
|
Posted: Wed Oct 24, 2007 1:12 pm |
|
|
From the datasheet:
Transparent Asynchronous UART Mode
...The data is modulated at RF without synchronisation or encoding. In receive mode the raw data signal from the demodulator is sent to the output. No synchronisation or decoding of the signal is done in CC1000 and should be done by the interfacing circuit.
That's what I am talking about. 'No synchronization' means that the byte boundaries can shift away.
First thing after receiveing is that the bit stream must be synchronized to the true byte boundaries, this must be done in software either by shifting the received data bitwise or skipping bits in the stream coming from the CC1000. |
|
 |
newguy
Joined: 24 Jun 2004 Posts: 1946
|
|
Posted: Wed Oct 24, 2007 1:30 pm |
|
|
| libor wrote: | From the datasheet:
Transparent Asynchronous UART Mode
...The data is modulated at RF without synchronisation or encoding. In receive mode the raw data signal from the demodulator is sent to the output. No synchronisation or decoding of the signal is done in CC1000 and should be done by the interfacing circuit.
That's what I am talking about. 'No synchronization' means that the byte boundaries can shift away.
First thing after receiveing is that the bit stream must be synchronized to the true byte boundaries, this must be done in software either by shifting the received data bitwise or skipping bits in the stream coming from the CC1000. |
That's what the PIC's USART does. And that's why the routine sends a LAM signal - so that the USART can properly lock on/distinguish the true byte boundaries. I've used this same procedure, verbatim, in a couple of different RF applications and it works perfectly. Trust me. |
|
 |
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
|
Posted: Wed Oct 24, 2007 1:46 pm |
|
|
OK. I see now, thay by using USART timing (proper stop bits, startbits) on both ends this can work. Though it can result in several bytes lost due to framing errors in the beginning of every packet. With such a short packets this might be a problem.
I was thinking sending the bytes in a continous stream (8 bits after 8 bits without any interbyte extra things). |
|
 |
newguy
Joined: 24 Jun 2004 Posts: 1946
|
|
Posted: Wed Oct 24, 2007 2:26 pm |
|
|
Ah, I see your point. But by my quick reading of the datasheet, it seems as though it should be possible to avoid losing bytes by monitoring the chip's frequency lock (?) output. I can't remember the exact name of the output.
I think it may be possible to only start the receive routine (enable the USART on the PIC) when the CC1000 tells you that it has locked onto a signal. This would help to avoid the loss of data. I guess that you could also monitor the CC1000's data clock line output as well - it seems as though it only toggles when valid data is available. |
|
 |
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Fri Oct 26, 2007 8:08 am |
|
|
Thanks for the help but as i am new to pic programming the advice that you are giving is a bit over my head so i will post help bit by bit where i get stuck.
In the folowing program does the > indicate the bits in the buffer or the bytes? What would the size of those buffers be if you look at that program from mohag.net??
| Code: | if (CCRX_BUFFCOUNT >= 4) {
if (temp == PREAMBLE) {
temp1 = GetCC1000();
temp2 = GetCC1000();
temp3 = GetCC1000();
output_high(pin_b3);
if ((temp1 == temp2) && (temp2 == temp3)) {
if (temp1 == 0x0A) {
...
}
if (temp1 == some other command value ....etc |
|
|
 |
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
|
Posted: Fri Oct 26, 2007 2:51 pm |
|
|
CCRX_BUFFCOUNT is an index into the buffer, gives the number of bytes received.
I suggest you to make a development/debug setup: Print the received bytes out of the serial port to your pc, so you can see what you are receiving. |
|
 |
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Fri Oct 26, 2007 3:36 pm |
|
|
I wull eventually do that, but as i am a bit pressed for time now during my exams i will only be able to do it in december. I am busy with my 3rd year project at university and i basically had to write the code to run a remote control car from a remote using the code that was already develepod by one of the other proffesors i only did the analog inputs on remote and pwm outputs of the car using the boards already develepod by the profs. The board already has a CC1000 conected to a pic16f886 with a few of the outputs of the pic available. The project is finished and i have sorted out all the programming i had to do for the remote and car and i did not do any develepment programming for the RF. All i basically want to do is change the small things on the RF that i can see, or understand but i don't understand everything regarding the RF that well.
I have never used the serial input to a PC to do debugging. Have you got some reference for me as to where to start or how it is done? |
|
 |
|