Comments (11)
Hello,
I think it's correct because you are using the orange pi zero pin configuration.
The radio.create
function takes two arguments. The first one is the GPIO pin correspondent to the CE pin in of the radio (see radio and raspberry pinout and gpio map), the second one is the spi id.
Run:
ls /dev
You should to see spidev0.0
and/or spidev1.0
if not run:
sudo raspi-config
and turn on spi from Interfacing Options
=> SPI
Now you have to see spidev0.0
and spidev0.1
on on general spidevX.Y
If you are using the first one the second parameter is 0 otherwise 1.
In general the second parameter is an integer that represent the id of the spi you find in /dev without dot. Example spidev0.0 => 0, spidev0.1 => 1, spidev1.0 => 10, ecc
Best regards
Giuseppe Riolo
from rf24js.
Thank you,
changing 10 to 0 helped with Segmentation Fault.
Could you please tell me what should the CE in create(ce, cs) be exactly (using RPI B+) a pin number 22 or coresponding GPIO number (25) ?
from rf24js.
You are welcome!
According with RF24 RPi bcm header file and this image at pin 22 should correspond gpio 25. A way to be sure your radio is working correctly is run printDetails
method.
It should be to print something similar to
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
If you read something like:
STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN
radio is not connected correctly.
If pin22/gpio25 does not work try with some other pin.
Regards
GR
from rf24js.
Thank you,
so I suppose I'm hooked right - as the printDetails throws somethink like that:
================ SPI Configuration ================
CSN Pin = CE0 (PI Hardware Driven)
CE Pin = Custom GPIO25
Clock Speed = 8 Mhz
================ NRF Configuration ================
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x65646f4e32 0x65646f4e31
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0x65646f4e32
RX_PW_P0-6 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x02
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
Unfortunatelly - trying to pong it in or out with Arduino:
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x65646f4e32 0x65646f4e31
RX_ADDR_P2-5 = 0xc3 0xc4 0x63 0x7f
TX_ADDR = 0x65646f4e32
RX_PW_P0-6 = 0x01 0x01 0x00 0x00 0x00 0x3f
EN_AA = 0x3f
EN_RXADDR = 0x02
RF_CH = 0x4c
RF_SETUP = 0x00
CONFIG = 0x0f
DYNPD/FEATURE = 0x03 0x06
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MIN
Gives me timeouts no matter the direction. If you have any advice it would be appreciated.
Thank you!
from rf24js.
Using nRF/RF24 arduino sample inside arduino and sample.js you find rf24js/samples in orange pi zero I successfully send data from mini-pc to arduino. Unfortunatelly with some problems at receiving time. The next week i will use interrupt and I will try to release a new version (with ts support).
Looking at your arduino trace RF_SETUP
register has a different value from minipc. You can try tro look the RF24 arduino samples, specially nRF24L01.h and more specific configurations.
Regards
GR
from rf24js.
Thank you again Giuseppe,
for anyone that has problems communicating one way or the other - when everything was checked, rewired and checked again - try replacing the mother board (arduino / pi) - looks like my fake arduino uno is a trash - and wont receive anything no matter what you do.
At the moment it looks I'm on tracks - right now fighting with pockets beeing lost around (done capacitors).
Could you please advice how to use function like setDataRate() ?
Using it like:
radio.setDataRate("RF24_250KBPS");
wont do anything,
radio.setDataRate(RF24_250KBPS);
gets me an undefined error obviously, and
radio.setDataRate(250);
doesnt seems to work either.
Thank you!
from rf24js.
Hello,
I have not mapped the enums at this time.
For any enum reference please use the low level header file.
According with line 38 of file above, for 250kbps you have to pass 2.
I'm sorry. It will be available with the next release.
Regards
Giuseppe
from rf24js.
According with line 38 of file above, for 250kbps you have to pass 2.
I'm sorry. It will be available with the next release.
Thank you - that explained everything. No worries - you did a great job so far!
I'm on a phase of planning the packets structure (trying to send few different values in one package, like int, float). Dunno if thats a good place to ask - but maybe you have some good ideas to make it work between C and node.js? Been thinking about C "struct".
from rf24js.
Hello, thanks you :)
I don't think use c-struct is a good idea. In my project im using a simple high speed byte serializer totally written in typescript. It's not still published but if you clone it, you can see how it works. I use this serializer to convert js object in byte array and vice versa. In the C side I'll read the byte array using a serial message protocol convention.
Serial message protocol convention
Start Length Message# Payload CKS1 CKS2 0x7E 0x08 0x01 0x0000 0x00 0x00
Where
- start is a convetional byte used to mark the start of a new message (in case of stream)
- Length is the message len without start and crc
- Message number is a number used to identificate message and associate an action or a semantic meaning
- Payload is the content of message (byte array)
- CRC bytes are the bytes computed excluding start and len
Note: for CRC you can use this
Regards
from rf24js.
Note: for CRC you can use this
Thank you - thats a nice module! Could you please advice what can I use for CRC from arduino side? The _crc16_update looks like its only suitable for numbers and gives me 0 for strings.
from rf24js.
Theoretically you can use any kind of CRC alg/config. I notice that one of the most used crc16 with arduino is CRC16_CCIT_ZERO. You can find helpful the issue at crc-full library about crc in c and javascript.
from rf24js.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rf24js.