|
|
View previous topic :: View next topic |
Author |
Message |
dmendesf
Joined: 31 Dec 2005 Posts: 32
|
|
Posted: Wed May 11, 2016 10:22 pm |
|
|
Thank you for your answer. I already found these websites (and others) talking about the differences between these clones. All of them use Arduino code to talk to them. I use this code with ccs and the most common clone and it works ok. The other ones doesn't seem to work no matter what I change trying to bypass their flaws, so i wanted to know if someone succeeded. |
|
|
Eduardo__
Joined: 23 Nov 2011 Posts: 197 Location: Brazil
|
|
Posted: Thu May 12, 2016 5:55 am |
|
|
Uau, It is really not good! Some of people that posted here can be using fake nRFs. Some code can not work!
;( _________________ Eduardo Guilherme Brandt |
|
|
dmendesf
Joined: 31 Dec 2005 Posts: 32
|
|
|
Eduardo__
Joined: 23 Nov 2011 Posts: 197 Location: Brazil
|
|
Posted: Thu May 12, 2016 6:41 am |
|
|
Thanks dmendesf and all of others answers.
It is really good to see it here ;) _________________ Eduardo Guilherme Brandt |
|
|
40inD
Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
|
|
Posted: Fri Sep 09, 2016 5:54 am |
|
|
Eduardo,
Code: |
int RF24_comm(int comm, int32 comm1, int commDS) { //commDS=datasize(1 to 32 bits)
int rv; //rv=return value(SPI nRF24 status read value)
RF24_select();
RF24_xfer(comm); //RF24 Write address/command(see RF24_addr addresses list tabble in .h file)
rv=spi_xfer(RF24_SPI, comm1, commDS);//Write config.value or command(1 to 32 bits of data)___I CANNOT USE RF24_xfer() ALIAS BECAUSE IT NOT ACCEPTS MORE THAN 1 PARAMETER
rv=spi_read2(); //It?s necessary due to spi_xfer read bug
RF24_unselect();
return rv; //Return last read value
} |
rises error "Expression must evaluate to a constant" for commDS |
|
|
Eduardo__
Joined: 23 Nov 2011 Posts: 197 Location: Brazil
|
|
Posted: Fri Sep 09, 2016 6:52 am |
|
|
Probably the problem is the version of the compiler.
The code worked originally in CCS version 4.124 or similar. _________________ Eduardo Guilherme Brandt |
|
|
chico_pic
Joined: 21 Sep 2012 Posts: 10
|
|
Posted: Fri Oct 14, 2016 9:05 pm |
|
|
Can someone help me, I want use pic16F1455.
I have this error
Code: |
rv=spi_xfer(RF24_SPI, comm1, commDS);//Write config.value or command(1 to 32 bits of data)___I CANNOT USE RF24_xfer() ALIAS BECAUSE IT NOT ACCEPTS MORE THAN 1 PARAMETER
|
*** Error 27: Expression must evaluate to a constant
and for other one is:
Code: | TX_BUFFER_FULL =0b00000001 //(R)(0)TX FIFO full flag. 1: TX FIFO full. 0: Available locations in TX FIFO.
|
*** Error 31: Identifier is already used in this scope
I use ccs 5.061
I change this
Code: | //********** DEFINE PORT NAMES
#define SPI_MISO PIN_C2 //SPI(Usar por hardware quando possivel)
#define SPI_MOSI PIN_C1 //SPI(Usar por hardware quando possivel)
#define SPI_CLK PIN_C0 //SPI(Usar por hardware quando possivel)
//Driver nRF24L01P.C
#define RF24_IRQ PIN_A4 //interrupcao nRF24L01+
#define RF24_CS PIN_C4 //chipselect nRF24L01+
#define RF24_CE PIN_C3 //chipEnable nRF24L01+
#define RF24_PERFORMANCE_MODE //performance mode ON
#define RF24_SPI NRF_SPI //Redirects SPI2 port to RS24_SPI stream
|
|
|
|
Eduardo__
Joined: 23 Nov 2011 Posts: 197 Location: Brazil
|
|
Posted: Mon Oct 17, 2016 11:29 am |
|
|
Have you seen the example file, at the top of this topic? _________________ Eduardo Guilherme Brandt |
|
|
zidged
Joined: 23 Nov 2012 Posts: 3
|
|
Posted: Wed Feb 01, 2017 11:55 am |
|
|
Dear Eduardo,
This is first signalling which generated from RF24_default_config() function.
As you can see some clocks are missing. I don't understand what is wrong. I am waiting for your reply as soon as possible.
I changed this function to check something.
Code: |
int RF24_comm(int comm, int32 comm1, int commDS) {
//commDS=datasize(1 to 32 bits)
int rv; //rv=return value(SPI nRF24 status read value)
RF24_select();
RF24_xfer(comm); //RF24 Write address/command(see RF24_addr addresses list table in .h file)
rv=spi_xfer(RF24_SPI, comm1, commDS); //Write config.value or command(1 to 32 bits of data)___I CANNOT USE RF24_xfer() ALIAS BECAUSE IT NOT ACCEPTS MORE THAN 1 PARAMETER.
rv=spi_read2(); //It´s necessary due to spi_xfer read bug
RF24_unselect();
return rv; //Return last read value
} |
I am getting:
Quote: | "Expression must evaluate to a constant" message cause that " rv=spi_xfer(RF24_SPI, comm1, commDS); " |
error message for "commDS".
I think this argument is the third byte of configuration parameters. |
|
|
zidged
Joined: 23 Nov 2012 Posts: 3
|
|
Posted: Thu Feb 02, 2017 11:12 am |
|
|
zidged wrote: | Dear Eduardo,
This is first signalling which generated from RF24_default_config() function.
As you can see some clocks are missing. I don't understand what is wrong. I am waiting for your reply as soon as possible.
I changed this function to check something.
Code: |
int RF24_comm(int comm, int32 comm1, int commDS) {
//commDS=datasize(1 to 32 bits)
int rv; //rv=return value(SPI nRF24 status read value)
RF24_select();
RF24_xfer(comm); //RF24 Write address/command(see RF24_addr addresses list table in .h file)
rv=spi_xfer(RF24_SPI, comm1, commDS); //Write config.value or command(1 to 32 bits of data)___I CANNOT USE RF24_xfer() ALIAS BECAUSE IT NOT ACCEPTS MORE THAN 1 PARAMETER.
rv=spi_read2(); //It´s necessary due to spi_xfer read bug
RF24_unselect();
return rv; //Return last read value
} |
I am getting:
Quote: | "Expression must evaluate to a constant" message cause that " rv=spi_xfer(RF24_SPI, comm1, commDS); " |
error message for "commDS".
I think this argument is the third byte of configuration parameters. |
i changed SPI configuration to Force_SW and done. |
|
|
zidged
Joined: 23 Nov 2012 Posts: 3
|
|
Posted: Thu Feb 02, 2017 11:13 am |
|
|
40inD wrote: | Eduardo,
Code: |
int RF24_comm(int comm, int32 comm1, int commDS) { //commDS=datasize(1 to 32 bits)
int rv; //rv=return value(SPI nRF24 status read value)
RF24_select();
RF24_xfer(comm); //RF24 Write address/command(see RF24_addr addresses list tabble in .h file)
rv=spi_xfer(RF24_SPI, comm1, commDS);//Write config.value or command(1 to 32 bits of data)___I CANNOT USE RF24_xfer() ALIAS BECAUSE IT NOT ACCEPTS MORE THAN 1 PARAMETER
rv=spi_read2(); //It?s necessary due to spi_xfer read bug
RF24_unselect();
return rv; //Return last read value
} |
rises error "Expression must evaluate to a constant" for commDS |
Change force_hw to force_sw! |
|
|
Eduardo__
Joined: 23 Nov 2011 Posts: 197 Location: Brazil
|
|
Posted: Thu Feb 02, 2017 11:21 am |
|
|
zidged wrote: | Dear Eduardo,
This is first signalling which generated from RF24_default_config() function.
As you can see some clocks are missing. I don't understand what is wrong. I am waiting for your reply as soon as possible.
i changed SPI configuration to Force_SW and done. |
But you lose performance using software SPI.
About the error given, check if you enabled passing strings from the RAM to the compiler, as shown below:
Code: | #device PASS_STRINGS=IN_RAM |
//It must be put in the beginning of the program.
Good luck friend! _________________ Eduardo Guilherme Brandt |
|
|
inservi
Joined: 13 May 2007 Posts: 128
|
Great Thank-you |
Posted: Tue Mar 14, 2017 2:46 am |
|
|
Great job, Thank-you :-) _________________ in médio virtus |
|
|
sebcar
Joined: 03 May 2017 Posts: 8
|
Problem with PIC16LF88 |
Posted: Wed May 03, 2017 5:35 am |
|
|
Dear Eduardo,
First, thank you for driver. However, it has been a long time since i have programed on PIC, and i did not manage to compile.
First I give my scheme:
[img]https://goo.gl/photos/4XMjeoEfiauCHvBMA[/img]
I use a PIC 16LF88, the internal oscillator at 4 MHz, ICSP and 3.3V PIC.
I program on CCS v 5.008.
Secondly I have this code:
.h File
Code: |
#include <16F88.h>
#DEVICE *=16 ICD=TRUE PASS_STRINGS=IN_RAM
#device ADC=10
#FUSES NOWDT //No Watch Dog Timer
#FUSES PUT //Power Up Timer
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#use delay(internal=4MHz)
#use STANDARD_IO( A )
#use FIXED_IO( A_outputs=PIN_A2,PIN_A1 )
|
The .c file:
Code: |
#include <Domotique Pic.h>
//#USE SPI (MASTER, SPI1, ENABLE=PIN_B3, MODE=0, BITS=8, STREAM=RF24_SPI)
//#USE SPI(FORCE_SW , DI=PIN_B1, DO=PIN_B2, CLK=PIN_B4,ENABLE=PIN_B3, MASTER, MODE=0, BITS=8, MSB_FIRST, STREAM=STREAM_SPI)
#USE SPI(FORCE_SW, SPI2, MASTER, BAUD=1000000, MODE=0, BITS=8, MSB_FIRST, STREAM=STREAM_SPI2)
#define BatMes PIN_A0
#define DhCt PIN_A1
#define BatCt PIN_A2
#define DHT-11 PIN_A4
#define SPI_MISO PIN_B1
#define SPI_MOSI PIN_B2
#define RF24_CS PIN_B3
#define SPI_CLK PIN_B4
#define RF24_CE PIN_B5
#define RF24_IRQ PIN_B0
#define RF24_PERFORMANCE_MODE //performance mode ON
#define PGC PIN_B6
#define PGD PIN_B7
#define RF24_SPI STREAM_SPI2
#include <nRF24L01P.c>
void main()
{
setup_adc_ports(sAN0);
setup_adc(ADC_CLOCK_INTERNAL);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); //2,0 s overflow
while(TRUE)
{
output_high(PIN_A7);
delay_ms(100);
output_low(PIN_A7);
delay_ms(100);
RF24_driver_use_example_TXdata_simple();
}
}
|
My problem is that I have to make modification into driver to compile.
I changed the code on:
Code: |
int RF24_comm(int comm, int32 comm1, int commDS) {
//commDS=datasize(1 to 32 bits)
int rv; //rv=return value(SPI nRF24 status read value)
RF24_select();
RF24_xfer(comm); //RF24 Write address/command (see RF24_addr addresses list tabble in .h file)
rv=spi_xfer(RF24_SPI, comm1); //Write config.value or command (1 to 32 bits of data)___I CANNOT USE RF24_xfer() ALIAS BECAUSE IT NOT ACCEPTS MORE THAN 1 PARAMETER rv=spi_xfer(RF24_SPI, comm1, commDS);
rv=spi_read2(); //It's necessary due to spi_xfer read bug
RF24_unselect();
return rv;
|
I have to suppress commDS from spi_xfer to not have the error:
"Expression must evaluate a constant".
Second error:
In nrf24l01p.h i modify:
Code: |
//Automated functions contemplated register.
enum RF24_STATUS { // **Status Register (In parallel to the SPI command word applied on the MOSI pin, the STATUS register is shifted serially out on the MISO pin)
IRQ_RX_dataready =0b01000000, // (0)Data Ready RX FIFO interrupt. Asserted when new data arrives RX FIFOc.Write 1 to clear bit.
IRQ_TX_datasent =0b00100000, // (0)Data Sent TX FIFO interrupt. Asserted when packet transmitted on TX. If AUTO_ACK is activated,this bit is set high only when ACK isreceived.Write 1 to clear bit.
IRQ_MAX_retransmit=0b00010000, // (0)Maximum number of TX retransmits interrupt Write 1 to clear bit. If asserted it must be cleared to enable further communication.
IRQ_ALL =0b01110000, // Allows clearing all IRQs at the same time
RX_PIPE0 =0b00000000, // (R)(bits 3:1)Data pipe number for the payload available for reading from RX_FIFO 000-101: Data Pipe Number
RX_PIPE1 =0b00000010, // (R)(bits 3:1)Data pipe number for the payload available for reading from RX_FIFO 000-101: Data Pipe Number
RX_PIPE2 =0b00000100, // (R)(bits 3:1)Data pipe number for the payload available for reading from RX_FIFO 000-101: Data Pipe Number
RX_PIPE3 =0b00000110, // (R)(bits 3:1)Data pipe number for the payload available for reading from RX_FIFO 000-101: Data Pipe Number
RX_PIPE4 =0b00001000, // (R)(bits 3:1)Data pipe number for the payload available for reading from RX_FIFO 000-101: Data Pipe Number
RX_PIPE5 =0b00001010, // (R)(bits 3:1)Data pipe number for the payload available for reading from RX_FIFO 000-101: Data Pipe Number
RX_BUFFER_EMPTY =0b00001110, // (R)Data pipe number for the payload available for reading from RX_FIFO 000-101: Data Pipe Number
TX_BUFFER_FULL2 =0b00000001 // (R)(0)TX FIFO full flag. 1: TX FIFO full. 0: Available locations in TX FIFO.
};
|
I have to change TX_BUFFER_FULL to TX_BUFFER_FULL2 to not have the error:
"Identifier is already used in this scope".
Are there some more errors to correct to be able to communicate as soon as possible ? I want to communicate with a Raspberry.
Thank you a lot.
Sebastien, Pic Dummy. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed May 03, 2017 5:57 pm |
|
|
sebcar wrote: |
I have to suppress commDS from spi_xfer to not have the error:
"Expression must evaluate a constant". |
That's because in modern versions of the CCS compiler, if you specify
hardware spi in the #use spi() statement, then CCS will only allow a
constant numeric value for the "number of bits" parameter in spi_xfer().
In other words, it gives an error for this:
Code: | rv=spi_xfer(RF24_SPI, comm1, commDS); |
But it will compile with this:
Code: | rv=spi_xfer(RF24_SPI, comm1, 8); |
But you don't have to worry about it. You can comment out the last
RF24_comm() function in that section of code. The last section is not used.
Comment it out, as shown below. Then it's no problem:
Code: |
/*
int RF24_comm(int comm, int32 comm1, int32 commDS) { //commDS=datasize(1 to 32 bits)
int rv; //rv=return value(SPI nRF24 status read value)
RF24_select();
RF24_xfer(comm); //RF24 Write address/command(see RF24_addr addresses list tabble in .h file)
rv=spi_xfer(RF24_SPI, comm1, commDS); //Write config.value or command(1 to 32 bits of data)___I CANNOT USE RF24_xfer() ALIAS BECAUSE IT NOT ACCEPTS MORE THAN 1 PARAMETER
// rv=spi_read(); //It´s necessary due to spi_xfer read bug
RF24_unselect();
return rv; //Return last read value
}
*/
|
sebcar wrote: | #USE SPI(FORCE_SW, SPI2, MASTER, BAUD=1000000, MODE=0, BITS=8, MSB_FIRST, STREAM=STREAM_SPI2)
#define RF24_SPI STREAM_SPI2
|
There are several problems in your #use spi() statement above:
1. There is no "SPI2" module in the 16LF88. That PIC only has SPI1.
2. It's better to use hardware SPI, because it's faster.
3. I see no need to rename the stream.
I changed it to this:
Code: | #USE SPI(MASTER, SPI1, BAUD=1000000, MODE=0, BITS=8, MSB_FIRST, STREAM=RF24_SPI)
// #define RF24_SPI STREAM_SPI2 // Comment out, or delete this line.
|
Then it should compile, though it will still give some warnings. |
|
|
|
|
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
|