Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traing to llisten to slave, or prhebs make some radio scanner #17

Open
Maksss2018 opened this issue Oct 20, 2019 · 7 comments
Open

Traing to llisten to slave, or prhebs make some radio scanner #17

Maksss2018 opened this issue Oct 20, 2019 · 7 comments
Assignees
Labels
question Further information is requested

Comments

@Maksss2018
Copy link

Hi,
tying to get new skills in IoT
here code for master:
`const nrf24=require("nrf24"); // Load de module

// Init the radio
var rf24= new nrf24.nRF24(37,24);
rf24.begin();
// Configure the radio
rf24.config({
PALevel: nrf24.RF24_PA_LOW,
DataRate: nrf24.RF24_1MBPS,
});

// Register Reading pipes
var pipe=rf24.addReadPipe("0x65646f4e31",true) // listen in pipe "0x65646f4e31" with AutoACK enabled.

// Register callback for reading
rf24.read( function(data,n) {
// when data arrive on any registered pipe this function is called
// data -> JS array of objects with the follwing props:
// [{pipe: pipe id, data: nodejs with the data },{ ... }, ...]
// n -> number elements of data array
console.log(" reciver Onn");
console.dir(data);

},function(isStopped,by_user,error_count) {
console.log(" reciver stopped");
console.log(" isStopped ", JSON.stringify(isStopped));
console.log(" by_user ", JSON.stringify(by_user));
console.log(" error_count ", JSON.stringify(error_count));

// This will be if the listening process is stopped.
});

//rf24.stopRead();

// If you want to abort pending async writes
//rf24.stopWrite();

// Finally to assure that object is destroyed
// and memory freed destroy must be called.
//rf24.destroy();

`
result:
getting error 101
reciver stopped
isStopped true
by_user false
error_count 101

code for slave:
`SPI1.setup({sck:A5, miso:A6, mosi:A7});
var nrf = require("NRF24L01P").connect( SPI1, B0, B1 );
function onInit() {
nrf.init([0,0,0,0,1], [0,0,0,0,2]);
}
onInit();
setInterval(function() {
digitalWrite(LED1,1);

//var value = analogRead(A0); // read a value in
nrf.sendString("!!!!!!.");

}, 2000);
`

@ludiazv ludiazv self-assigned this Oct 21, 2019
@ludiazv ludiazv added the question Further information is requested label Oct 21, 2019
@ludiazv
Copy link
Owner

ludiazv commented Oct 21, 2019

Hi @Maksss2018,
From the trace you are showing it seems that there is a problem in reading thread. It stops as the error_count is >100. This is a safety features to avoid non working radios and the application can detect this condition.
It seems that you have a wiring/pin assingantion problem. Your initialization command is also uncommon: var rf24= new nrf24.nRF24(37,24); What board are you using? How the radio is wired?

Regards,

@Maksss2018
Copy link
Author

Maksss2018 commented Oct 21, 2019

well, ludiazv, I'm using orange pi pc - I was using this instruction to connect nrf24l01 + adapter for receiver
зображення

As you can see this is schema for orange pi no Pc so i run WiringOP readall to get correct gpio

@ludiazv
Copy link
Owner

ludiazv commented Oct 22, 2019

For Orange Pi you need to have spidev activated in your case spi0 is /dev/spidev0.0. Check constructor documentation CS pin in this case should be 0. (CS=*10+ for /dev/spidev.) for the CE pin should be 25 if this is the pin. check the documentation of the orange pi to map the pin to the number in linux.

@Maksss2018
Copy link
Author

Sounds nice - I'll investigate in this way. Thank you very much

@Maksss2018
Copy link
Author

Maksss2018 commented Oct 22, 2019

Well, I've changed boot environment with armbian-config to . And than I found that al this time there was no power 8)))) now I wondering how to check is other pinc is working because after I run ls -l /dev/*spi* ... command return nothing

`

@ludiazv
Copy link
Owner

ludiazv commented Oct 22, 2019

Without spidev the library can't work. Check armbian documentation on how to enable spidev overlays for your board. Armbian forums are great to solve this kind of issues. Sorry I can't help with that.

@Maksss2018
Copy link
Author

Thank you anywhere ... I've turn on spidev overlay with armbian-config but steel no result. I was hoping to so some-sing with gpio readall - no changes there .. well thank you again, i will try luck on armbian dist forums

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants