Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NRF24L01 in pinguino
02-10-2013, 02:27 PM,
#11
RE: NRF24L01 in pinguino
(02-10-2013, 08:37 AM)regis Wrote: Some ideas :

Why don't you use transistors instead of your MAX232 ? I would make something like that :


or make a level-shifter such as this one :
https://www.sparkfun.com/products/8745?
Schematic is there also:
http://www.sparkfun.com/datasheets/Break...er-v10.pdf
If you want to spend money:
http://www.analog.com/en/interface-isola...index.html

or just make/buy a Pinguino 26j50 ;-)

hehe yes, the idea is to keep it cheap, so I'll try with some transistors. I have a couple BC547 left. But I'll have to calculate the resistance to make them work too.

@pingotg. Yes, I saw the tutorials, but the problem lies in the SPI communication, I need to get that working first, then I can take a look at the nrf24l01 registers and other details mentioned in the tutorials.

Thanks for the suggestions
Reply
03-10-2013, 02:17 AM, (This post was last modified: 03-10-2013, 02:34 AM by dc_740.)
#12
RE: NRF24L01 in pinguino
regis, I used the following (bottom) schematic to change the voltage level     . Still no connection. Could it be the SPI implementation? I have no experience in this.


UPDATE: scratch that. I don't have an oscilloscope, but I can see the tester going 0-0,05-0-0,05 when I place it in the input for the level shifter... and it always stays at 0 at the output. At least I was expecting some weird behavior caused by a wrong measure in the tester (like the one in the input), but I'm clearly getting just 0. I'll be checking the level shifter again before saying anything else

oh man... I would really like to have an oscilloscope right now! (I think I said this before Tongue)
Reply
06-10-2013, 05:19 PM,
#13
RE: NRF24L01 in pinguino
(03-10-2013, 02:17 AM)dc_740 Wrote: regis, I used the following (bottom) schematic to change the voltage level . Still no connection. Could it be the SPI implementation? I have no experience in this.


UPDATE: scratch that. I don't have an oscilloscope, but I can see the tester going 0-0,05-0-0,05 when I place it in the input for the level shifter... and it always stays at 0 at the output. At least I was expecting some weird behavior caused by a wrong measure in the tester (like the one in the input), but I'm clearly getting just 0. I'll be checking the level shifter again before saying anything else

oh man... I would really like to have an oscilloscope right now! (I think I said this before Tongue)

I gave up.
I had a BC547C instead of a BC547, so I had to recalculate the resistance to cause the saturation. That's why the level shifter was not working.
I managed to make the 3.3V to 5V circuit work, but it didn't work when I connected it to the pinguino. I'll try to debug it later if I manage to get an oscilloscope or something, but I just wanted to update the post. It's probably a bug when I try to setup the SPI connection. Right now I'm not sure if it's a hardware or a software problem. Probably software.
I got this module to work in Arduino Mega, Raspberry Pi, Teensy++ 2.0 and Teensy 3.0 though.

Thanks everyone
Reply
09-10-2013, 03:13 PM,
#14
RE: NRF24L01 in pinguino
Let's show your code.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
30-11-2013, 03:00 AM, (This post was last modified: 04-04-2017, 07:16 PM by dc_740.)
#15
RE: NRF24L01 in pinguino
(09-10-2013, 03:13 PM)regis Wrote: Let's show your code.

Sorry it took so long.

The code is composed of a Ping/Pong sketch. I totally gave up trying to make it work. I ended up using a bidirectional level shifter from sparkfun, which worked OK. (the logic analyzer shows the SPI connection is healthy. I can see the pic successfully asking for the nrf24l01 status, writting/reading registers, etc).
Yet I'm not able to connect from a pic to an arduino (this side is tested and working). No matter what I do, the packets never reach the destination. Maybe some timing issue. 
I honestly don't know what was wrong, and I ran out of time too. if someone else finds a way to make them work, just let me know. I'll be glad to switch back to pinguino for this module, but I'm not spending any more time in this.

Thanks everyone.
Reply
04-04-2017, 07:39 PM, (This post was last modified: 05-04-2017, 06:58 PM by dc_740.)
#16
RE: NRF24L01 in pinguino
Update: I updated the code. Now it's a 1:1 port from the official RF24 library from Arduino (to date). Yet my problem seems to be always the same. I can't get the SPI link to work.

I attach the ported code. just in case someone gets the SPI link to work with pinguino and an 18f4550 (20mhz xtal). If you do, please add a comment. I also attach the pinout I'm using. I added a 4.7k resistance from MISO to 5V, because the pic doesn't read the 3v level as a HIGH, and it seems to be what everyone else is using on the MISO pin (according to google). (no one uses any special level shifter circuit as I tried before, they simply add the resistance)

It does work on arduino and teensy. So far the pic is the only device I'm having problems with.

About the hardware:The pinout and circuit are OK. I've double checked way too many times. I also ended up using a protoboard to easily replace the pic with an arduino (always double checking the pinout). If I connect the arduino, it works, I replace the arduino with a pic, and it stops working.

About the software: here is the SPI setup


Code:
void RF24_spi_init(){
   SPI_setMode(SPI1, SPI_MASTER_FOSC_16);
   SPI_setDataMode(SPI1, SPI_MODE1);   //CPOL/CKP=0,  Clock edge/CKE=1
   SPI_setBitOrder(SPI1, SPI_MSBFIRST);
   SPI[SPI1].phase = SPI_SMPEND; //this is the only way to set this on v11
   
   SPI_begin(SPI1);
}
I hope the code can help someone else.


Attached Files Thumbnail(s)
   

.zip   libpicRF.zip (Size: 38.96 KB / Downloads: 3)
Reply
05-04-2017, 10:57 AM,
#17
RE: NRF24L01 in pinguino
Hi, 
I'm quite busy now but as soon as I have more time I will try your lib. and add it to the Pinguino distribution.
Thank you.
Régis
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
05-04-2017, 04:20 PM,
#18
RE: NRF24L01 in pinguino
Hi, that'd be great, yet I want to make perfectly clear that I never got the project to work. I was unable to properly read and write to the SPI interface. The library may or may not work, I don't know, since attaching the logic analyzer even changed the behaviour, and my knowledge in electronics and circuits is relatively limited (I'm a software engineer).

Having said that, if some day you happen to make it work, please add a comment here. I would love to see it finally working after so many years gathering dust in the shelf.

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)