-
• #2
Hi, there's not actually a problem - the module just isn't designed to export the constants. In the module the variable C is defined, but it isn't assigned to exports.C so you can't use it directly.
For simple tests it's probably best to just copy the value out of the module
-
• #3
Thanks a lot, Gordon. I can't still establish connection between 2 NRF's. Sending
nrf.sendCommand("1+2", function(r) { print("=="+r); });
I've always got the Tx timeout subj.
I managed the spi connection, and did as you recomended: nrf.getAddr(0x0b); but here in this topic: http://forum.espruino.com/conversations/244/#comment1930 you told that the answer must be like [0,0,0,0,1], but I've got [1,0,0,0,1]. Is it wrong answer? And what I have to pay attention more to get the connection?
Thanks again. -
• #4
Additionaly here is the registers content of master side:
=undefined >nrf.getAddr(0x00) =[0,0,0,0,0] >nrf.getAddr(0x01) =[63,63,63,63,63] >nrf.getAddr(0x02) =[3,3,3,3,3] >nrf.getAddr(0x03) =[3,3,3,3,3] >nrf.getAddr(0x04) =[3,3,3,3,3] >nrf.getAddr(0x05) =[2,2,2,2,2] >nrf.getAddr(0x06) =[0,0,0,0,0] >nrf.getAddr(0x07) =[14,14,14,14,14] >nrf.getAddr(0x08) =[0,0,0,0,0] >nrf.getAddr(0x09) =[0,0,0,0,0] >nrf.getAddr(0x0A) =[1,0,0,0,1] >nrf.getAddr(0x0B) =[2,0,0,0,2] >nrf.getAddr(0x0C) =[195,195,195,195,195] >nrf.getAddr(0x0D) =[196,196,196,196,196] >nrf.getAddr(0x0E) =[197,197,197,197,197] >nrf.getAddr(0x0F) =[198,198,198,198,198] >nrf.getAddr(0x10) =[1,0,0,0,1] >nrf.getAddr(0x11) =[0,0,0,0,0] >nrf.getAddr(0x12) =[0,0,0,0,0] >nrf.getAddr(0x13) =[0,0,0,0,0] >nrf.getAddr(0x14) =[0,0,0,0,0] >nrf.getAddr(0x15) =[0,0,0,0,0] >nrf.getAddr(0x16) =[0,0,0,0,0] >nrf.getAddr(0x17) =[1,1,1,1,1] >
Looks it ok, or maybe some things are wrong?
furthermore:
Finding the problem I discovered the sequence in module code:
masterHandler func waiting for non-zero dataReady func result,
which can be non-zero in case when func getReg(STATUS=7) returns not 14 value, but it returns exactly 14. inside of getReg I see spi.send which returns 14.>nrf.spi.send([7,0],B0)[1] =14
Gordon, does It mean than something is wrong with the SPI settings, or NRF module?
I checked 2 brand-new modules with the same results. -
• #5
I'd be pretty sure that SPI is working fine and that the modules are doing the right thing if you can read the register values. The
Tx timeout
is because the module is sending the data and waiting for a response, but it isn't getting it from what it's sending to.Can you paste up the code that you used to initialise each module? One module needs to have one address, say:
nrf.init([0,0,0,0,2], [0,0,0,0,1]);
and the other must have the opposite:
nrf.init([0,0,0,0,1], [0,0,0,0,2]);
-
• #6
sure, I took code from the site: slave:
SPI1.setup({sck:A5, miso:A6, mosi:A7,baud:100000}); 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() { nrf.slaveHandler(); }, 50);
and master:
SPI1.setup({sck:A5, miso:A6, mosi:A7,baud:100000}); var nrf = require("NRF24L01P").connect( SPI1, B0, B1 ); function onInit() { nrf.init([0,0,0,0,2], [0,0,0,0,1]); } onInit(); setInterval(function() { nrf.masterHandler(); }, 50);
-
• #7
I thought also, that installed GYRO chip on the board, connected to spi1 can disturb to communication, but its CS signal is in "1" what means that it disabled. And the registers look ok, all but RX_ADDR_P1 and RX_ADDR_P0. Supply of the NRF boards are ok (3.0V took from the F3 boards). NRF's are close to each other.
-
• #8
Ok, and you always get
TX not received
when sending? Could you connect to both boards at the same time, so that you can see if anything happens on the slave (like maybe there is some error initialising). -
• #9
I always get "TX timeout" from NRF.prototype.send. I connected both boards, and seen no errors or something else on the slave side. :-(
-
• #10
Update: Changed both NRF's to new - the same "TX timeout" .
-
• #11
What was the number after TX timeout?
I just updated the NRF module - can you try again? I'm not sure if it'll help, but it changes some of the default nrf register values, and also adds the ability to set the data rate.
-
• #12
>nrf.sendCommand("1+2", function(r) { print("=="+r); }); TX timeout =undefined
the same. no numbers after TXtimeout
-
• #13
I tryed to connect nrf to SPI2 using
SPI2.setup({sck:B13, miso:B14, mosi:B15,baud:100000});
var nrf = require("NRF24L01P").connect( SPI2, B0, B1 );
it doesn't work after downloading - I can't put any command in teminal after that. -
• #14
On the STM32F3Discovery board again?
Honestly I don't know what to suggest - did you try the suggestions I sent in response to your PM? What responses did you get?
It seems plenty of other people here are using this fine with the Espruino board so I really don't know what's going wrong in your case...
-
• #15
ok, anyhow I'll keep trying to get it working. Perhaps I have to buy some logik analyser to investigate data traffic more detailed. Thanks for your time, Gordon.
-
• #16
Just a thought: What about using software SPI?
var spi = new SPI(); spi.setup({sck:A5, miso:A6, mosi:A7}); var nrf = require("NRF24L01P").connect( spi, B0, B1 );
That'll work on any pins, and should avoid any issues there may be with hardware as it uses just normal GPIO. If that doesn't work, maybe it's something as simple as a power supply issue?
-
• #17
Hi, Gordon, Hi all! Good day! It starts working! after
var spi = new SPI()
I've got an answer>nrf.sendCommand("1+2", function(r) { print("=="+r); }); TX not received 30 =undefined ==3
why it says "TX not recieved".... But at least it works! Thanks a lot!
Also>nrf.getAddr(0x0b) =[0,0,0,0,2]
not [2,0,0,02] as before.
Actually, you've recomended new SPI() to Daniel here: http://forum.espruino.com/conversations/244/#comment1930
but i couldn't imagine that it's the way to fix the problem. -
• #18
Great! Glad it's sorted! Not sure why you get the 'TX not received' either, but at least it's a good start!
It could be it's an issue with SPI on the STM32F3 - I guess possible issues could be:
- SPI CPOL/CPHA wrong
- nCS (the last arg to SPI.send) is raised too soon (although I thought we'd tested for that by connecting nCS to MISO) and sending some bytes
Hopefully someone with a storage scope or signal analyser might be able to figure out what's up...
- SPI CPOL/CPHA wrong
-
• #19
I must say: after cleaning both boards >>> reset(); save() TX not received message has gone
-
• #20
great! does that happen even when using hardware spi?
-
• #21
no, hardware spi still doesn't work. soft spi works well.
Hi all!
trying to connect NRF24L01 to my F3Discovery i use the sample
then try nrf.getAddr(nrf.C.RX_ADDR_P1) to check SPI communication and get:
why C is undefined and what wrong with It?
IDE v 0.44.0 espruino 1v63
I tryed "No minification" and "Simple Optimizations" in
communication Settings.