attiny 85, any pointers?/

Thanks guys, I'll try with the led debugging stuff you suggested and let you know!
Quick question, do I need to have the receiver portion working to test the transmitter (i.e. is there any acknowledge that the tx is expecting from the rx) ? Or I can just setup the attiny with the "debugger" code you posted and start transmitting without any receiver device?

Thanks so much,
Fabio

fgasparri:
Thanks guys, I'll try with the led debugging stuff you suggested and let you know!
Quick question, do I need to have the receiver portion working to test the transmitter (i.e. is there any acknowledge that the tx is expecting from the rx) ? Or I can just setup the attiny with the "debugger" code you posted and start transmitting without any receiver device?

Thanks so much,
Fabio

Nope. That's the best thing about it, it's just there to test the wiring on the attiny.

someone could run the library with ATTINY44?

raedon:
someone could run the library with ATTINY44?

Ship me an ATTINY44 and I'll do it for you :slight_smile:
Otherwise, just take a look at the SPI85 class and change the pins. You'll need to find which are the correct pins for MOSI, MISO, SCK, etc.. for the ATTINY44 and put them there. Good luck!

Davste:

raedon:
someone could run the library with ATTINY44?

Ship me an ATTINY44 and I'll do it for you :slight_smile:
Otherwise, just take a look at the SPI85 class and change the pins. You'll need to find which are the correct pins for MOSI, MISO, SCK, etc.. for the ATTINY44 and put them there. Good luck!

Funny enough I've done this with an 84 and for some reason, haven't had any luck.

I have a couple of 84s on the way. I have had some very thourough experience with the 85s, and have routines ready that can check if all the wiring, etc.. is OK. I think, if there's a way, I'll probably manage, the only problem is if I have time to do it. I will share the wiring and code if I manage.

Take a look at this example, use the same ATTINY85 and within comments puts another example using a ATTINY44.

http://www.insidegadgets.com/2012/08/22/using-the-nrf24l01-wireless-module/

raedon:
Take a look at this example, use the same ATTINY85 and within comments puts another example using a ATTINY44.

http://www.insidegadgets.com/2012/08/22/using-the-nrf24l01-wireless-module/

Really, do take a look at the SPI85 class man. One of the files is literally something like
mosi = PA5;
miso = PA6;
etc.. Where PA5 and PA6 are pin names.
Then, find the datasheet for the ATTINY44:
PA5 (ADC5/DO/MISO/OC1B/PCINT5)
PA6 (PCINT6/OC1A/SDA/MOSI/DI/ADC6)
PA4 (ADC4/USCK/SCL/T1/PCINT4)
Those are the important ones. CE and CSN are probably variable.
Finally, make sure everything is wired correctly. Then use the code I've posted previously to check the wiring. Sorry I can't help any more, really busy.

sorry if bother you was not my intention, my question was just to ask if it was possible to make it work, do not spend more time on this library because I had found the one I posted recently, now I have at least two options to try.

raedon:
sorry if bother you was not my intention, my question was just to ask if it was possible to make it work, do not spend more time on this library because I had found the one I posted recently, now I have at least two options to try.

I actually had used that out of desperation in those four days I spent debugging. You'll find my name on that page as "David" :slight_smile:

You may find it is not easy to get it up and running. You will need to install WinAVR, programmer's notepad and set up the makefile to get it to compile and send it to the ATTiny44. Fortunately I have the Makefile already set up, it's in one of the dropbox links in one of my questions on that page.
You can try but I don't recommend it. You will waste lots of time setting it up, and even if you manage to get it to work, the arduino libraries are missing in AVR, and it's a whole different level of coding. Don't know what's your experience in that area. If you have time, go ahead, nothing to lose but try! :slight_smile:

I already make the changes to the file to make it work with the ATTINY44, also change files mirf.cy mirf.h setup.c fail me burn only the ATtiny, I'll do that tomorrow also see what I can do I'll take a look at your code because I have only one module NRF24L01 free to use

Watch out, by the way. I've managed to burn 3 nRF modules by swapping around the ground and VCC at 3 AM. Happened for a second or two and from then on it just wouldn't receive anything. It would return 0 or 255 randomly as status instead of working. I can confirm this as when I replaced it with a different card, it worked.

Davste:
I've managed after five days of mucking around with it :slight_smile:
Remember to try different channels. That may have been one of the problems for me.
Here's the code I'm using right now (that works):

ATTiny85:

#include <avr/io.h>

#include <inttypes.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <SPI85.h>
#include <Mirf85.h>
#include <nRF24L0185.h>
#include <MirfHardwareSpiDriver85.h>

const int bufferSize = 2;
byte buffer[] = {
  'D','S'
};

#define CE  PB3 //ATTiny
#define CSN PB4 //ATTiny

void setup(){
  Mirf.cePin = CE;
  Mirf.csnPin = CSN;
  Mirf.spi = &MirfHardwareSpi;
  Mirf.init();

Mirf.setRADDR((byte *)"clnt2");
  Mirf.payload = 2;
  Mirf.channel = 80;
  Mirf.setTADDR((byte *)"clnt1");
  Mirf.config();
}

void loop(){
  Mirf.send(buffer);
  while( Mirf.isSending() )
  {
    delay(1);
  }
  delay(1000);
}

I can't seem to find the below *85 header files, which libs are they from ??
#include <SPI85.h>
#include <Mirf85.h>
#include <nRF24L0185.h>
#include <MirfHardwareSpiDriver85.h>

Or could you just zip up all the attiny & headers and shared it as a dropbox links ?

Thanks

Stanley:
Or could you just zip up all the attiny & headers and shared it as a dropbox links ?

Thanks

They are on this thread, look at this post:

winner10920:
Guess my phone didn't upload it right, ill try again
i may have to get a different browser on my phone

make sure you are logged in or you won't see the file.

Great project! Tough challenges! Here are some pointers:

Cosa: The Virtual Wire Interface (VWI) See fig. 7 ATtiny85 with ultra cheap RF433 transmitter and 1-Wire Digital Thermometer. You can find the transmitter sketch at https://github.com/mikaelpatel/Cosa/blob/master/examples/VWI/CosaVWItempsensor/CosaVWItempsensor.ino and the receiver sketch at https://github.com/mikaelpatel/Cosa/blob/master/examples/VWI/CosaVWItempmonitor/CosaVWItempmonitor.ino

Your project is a great encouragement to port the Cosa NF24L01 driver to ATtiny85. First a USI/SPI driver will be needed.

Cheers!

Davste:
They are on this thread, look at this post:

Thanks Dave for the links.... still have not gotten it to work "yet"!!!

How do you debug the attiny85 ? I scope both the CSN and MOSI pins... but still nothing on the Arduino UNO side...

I finally got it working... thanks for the sample codes, spi85 and mirf85 libs..

I'm running on channel 0x50 as the scanner shows no traffic at this channel...

I made some modifications to add support for 1Mbps as the default mirf is running on 2Mbps..
*** Do the same for the mirf libraries..

[edit]
I got it working for RF24 as most of my UNO/RPi is running on RF24 here :- GitHub - stanleyseow/RF24: Arduino and Raspberry Pi driver/libraries for nRF24L01

Changes needed in the mirf / mirf85 codes :-

  1. the address is flipped when configure in mirf (no idea why???) :-
    byte TADDR[] = {0xe3, 0xf0, 0xf0, 0xf0, 0xf0}; will match RF24 :-
    const uint64_t pipes[2] = { 0x7365727631LL, 0xF0F0F0F0E3LL };

  2. Default CRC for mirf is 8bit so set the RF24 radio.setCRCLength(RF24_CRC_8) or change mirf85.h line 38 :-
    #define mirf_CONFIG ((1<<EN_CRC) | (1<<CRCO) ) // 1 << CRC0 is 16bit/2bytes

  3. Default data rate for nRF24L01/mirf is 2Mbps, so set the RF24 radio.setDataRate(RF24_2MBPS)

  4. Channels can be confusing, so use 0x50 or whatever in HEX ( 0xnn) when setting the channel for both

  5. Enable dynamic payload ( I enable them for all my RF24 receivers ) in mirf :-

// Enable dynamic payload in attiny85 mirf
Mirf.configRegister( FEATURE, 1<<EN_DPL );
Mirf.configRegister( DYNPD, 1<<DPL_P0 | 1<<DPL_P1 | 1<<DPL_P2 | 1<<DPL_P3 | 1<<DPL_P4 | 1<<DPL_P5 );

I made an 6-pin adapter on top of the attiny85 for easy uploading of hex to the attiny85 and I put an LED at Pin2 to blink 3 times during the 1 sec delays when isSending is successful..

Drawing 3.3V power from a breadboard power supply and USBtinyISP as my programmer...

attiny85

 Mirf.rfsetup = 0x06; // RF_SETUP settings :- 0x06 = 1Mbps, max power, 0x0e for 2Mbps, max power

mirf85.cpp

Nrf24l::Nrf24l(){
	cePin = 3;
	csnPin = 4;
	channel = 40;
	payload = 5;
	rfsetup = 0x06; // 1Mbps, max power
	spi = NULL;
}

void Nrf24l::config() 
// Sets the important registers in the MiRF module and powers the module
// in receiving mode
// NB: channel and payload must be set now.
{
    // Set RF channel
	configRegister(RF_CH,channel);
    // Set RF_SETUP
	configRegister(RF_SETUP,rfsetup);

    // Set length of incoming payload 
	configRegister(RX_PW_P0, payload);
	configRegister(RX_PW_P1, payload);

    // Start receiver 
    powerUpRx();
    flushRx();
}

mirf85.h

		/*
		 * Rate is RF_SETUP, 0x06 is 1Mbps, Max power
		 */

		uint8_t rfsetup;

Hi,

I've compiled all the files, headers and examples and made a github repo for future references :-

Pls let me know if you need me to add examples to the repo...

Anyone searching for attiny nrf24L01 at github should be able to find it...

Spectacular work stanley thanks for the work that you had done to collect everything in one place.

Thanks.

Stanley:
I've compiled all the files, headers and examples and made a github repo for future references :-
Pls let me know if you need me to add examples to the repo...

Thanks for sharing your success. I think a test example is always a good idea for these, so yes please. :slight_smile:

Geoff