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

Compatibility with Teensy 3.x #7

Closed
ghost opened this issue May 18, 2014 · 10 comments
Closed

Compatibility with Teensy 3.x #7

ghost opened this issue May 18, 2014 · 10 comments

Comments

@ghost
Copy link

ghost commented May 18, 2014

No description provided.

TMRh20 referenced this issue May 19, 2014
- Adjusted define in RF24_Config.h for teensy
- Teensy doesn't seem to support extended SPI methods, may not perform
as well as on Due
- Currently compiles, but is untested with teensy
@TMRh20
Copy link
Member

TMRh20 commented May 19, 2014

It compiles now for Teensy 2 & 3 boards, but I do not have a board for testing. Please let me know if there are any problems.

@ghost
Copy link
Author

ghost commented May 25, 2014

Now it compiles, but doesn't work. I don't know if this helps, but this fork works perfectly on teensy 3.x - https://github.com/sumotoyy/RF24 (edited link, earlier link was incorrect)

@TMRh20
Copy link
Member

TMRh20 commented May 30, 2014

Yeah, that definitely helps, but also adds to my confusion somewhat. I took a good look through the code, and from what I can tell, the main issues with the Teensy would revolve around the printf stuff, but the radio should work otherwise unless I made a mistake somewhere.
Beyond that, the linked repo includes some additional printf related changes for the Due that don't all seem to be required from what I can tell, so unfortunatey I'm still not completely clear on what is specifically required for the Teensy vs the Due.
If you don't mind me asking, what happens if you don't include printf.h and remove printf_begin(), do you get any output from radio.printDetails(); on the Teensy with the current code? Does the radio not work at all? Without the hardware or a complete understanding of the differences, I'm kind of limited in what I can do, so can't promise much as far as getting this working soon.

TMRh20 added a commit that referenced this issue Jun 6, 2014
- Moved printf.h to root library folder
- Modified printf.h for better compatibility with Arduino Due and Teensy
- Fixed some potential bugs preventing Teensy from working
- Improved Due support and performance
- may help correct issue #7
@luizrrocha
Copy link

TMRh20, my 2 cents: the sumotoyy fork has a delayMicroseconds(10) in startWrite....

TMRh20 added a commit that referenced this issue Jul 29, 2014
Modified write() to use startFastWrite, then toggle CE after completion
to remove need for a delay on some boards.
Added delay to startWrite for non-Arduino boards.
Removed receive buffer flushes. This prevents an issue in the
RF24Network library, where payloads would be received, but flushed when
a transmission takes place prior to reading.
Should address issues #7 and #11
@TMRh20
Copy link
Member

TMRh20 commented Jul 29, 2014

Ok, I think commit 1d18015 will address the issue.

I've added a delay to startWrite for non-Arduino and Teensy boards, and have modified the standard radio.write() to remove the need for a delay on all boards. It passes all my tests, so hopefully this will do the trick.

TMRh20 added a commit that referenced this issue Oct 1, 2014
Per a tip from Andrew A. this should be the final nail in the coffin of
issue #7
TMRh20 added a commit that referenced this issue Oct 2, 2014
Per a tip from Andrew A. this should be the final nail in the coffin of
issue #7
@TMRh20 TMRh20 added the question label Oct 6, 2014
@ghost
Copy link

ghost commented Mar 14, 2015

Hi , i tried to build Getting started example with arduino and teenseyduino on teensy 3.1 board. and the following errors occur:

any suggestions?

Arduino: 1.6.1 (Mac OS X), TD: 1.21-beta10, Board: "Teensy 3.1, Serial, 16 MHz (No USB), Italian"

Build options changed, rebuilding all
In file included from /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/WProgram.h:11:0,
from /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Arduino.h:1,
from /Users/antdem/Documents/Arduino/libraries/RF24/arch/Teensy/RF24_arch_config.h:6,
from /Users/antdem/Documents/Arduino/libraries/RF24/RF24_config.h:58,
from /Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp:10:
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp: In member function 'void RF24::print_byte_register(const char_, uint8_t, uint8_t)':
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:49:49: error: expected primary-expression before ')' token
#define printf_P(f, ...) printf((f), VA_ARGS)
^
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp:436:3: note: in expansion of macro 'printf_P'
printf_P(PSTR("\r\n"));
^
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp: In member function 'void RF24::print_address_register(const char_, uint8_t, uint8_t)':
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:49:49: error: expected primary-expression before ')' token
#define printf_P(f, ...) printf((f), VA_ARGS)
^
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp:456:5: note: in expansion of macro 'printf_P'
printf_P(PSTR(" 0x"));
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:49:49: error: expected primary-expression before ')' token
#define printf_P(f, ...) printf((f), VA_ARGS)
^
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp:462:3: note: in expansion of macro 'printf_P'
printf_P(PSTR("\r\n"));
^
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp: In member function 'void RF24::printDetails()':
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:56:60: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#define pgm_read_word(addr) ((const unsigned short *)(addr))
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:49:38: note: in definition of macro 'printf_P'
#define printf_P(f, ...) printf((f), VA_ARGS)
^
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp:604:41: note: in expansion of macro 'pgm_read_word'
printf_P(PSTR("Data Rate\t = %s\r\n"),pgm_read_word(&rf24_datarate_e_str_P[getDataRate()]));
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:56:60: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#define pgm_read_word(addr) (
(const unsigned short )(addr))
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:49:38: note: in definition of macro 'printf_P'
#define printf_P(f, ...) printf((f), VA_ARGS)
^
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp:605:39: note: in expansion of macro 'pgm_read_word'
printf_P(PSTR("Model\t\t = %s\r\n"),pgm_read_word(&rf24_model_e_str_P[isPVariant()]));
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:56:60: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#define pgm_read_word(addr) (
(const unsigned short )(addr))
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:49:38: note: in definition of macro 'printf_P'
#define printf_P(f, ...) printf((f), VA_ARGS)
^
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp:606:42: note: in expansion of macro 'pgm_read_word'
printf_P(PSTR("CRC Length\t = %s\r\n"),pgm_read_word(&rf24_crclength_e_str_P[getCRCLength()]));
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:56:60: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#define pgm_read_word(addr) (
(const unsigned short *)(addr))
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/avr/pgmspace.h:49:38: note: in definition of macro 'printf_P'
#define printf_P(f, ...) printf((f), VA_ARGS)
^
/Users/antdem/Documents/Arduino/libraries/RF24/RF24.cpp:607:42: note: in expansion of macro 'pgm_read_word'
printf_P(PSTR("PA Power\t = %s\r\n"), pgm_read_word(&rf24_pa_dbm_e_str_P[getPALevel()]));
^
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

@TMRh20
Copy link
Member

TMRh20 commented Mar 14, 2015

In your compile errors:

from /Users/antdem/Documents/Arduino/libraries/RF24/arch/Teensy/RF24_arch_config.h:6,

points to:

  #if ARDUINO < 100
    #include <WProgram.h>

Which seems to indicate you are using an old version of the Arduino IDE? Is this the case?
It seems to compile fine for me using IDE 1.0.6

@ghost
Copy link

ghost commented Mar 14, 2015

i'm using arduino 1.6.1 in this case, but i can revert on 1.0.6 to solve.

@TMRh20
Copy link
Member

TMRh20 commented Mar 14, 2015

Aha, I believe TeensyDuino for 1.6.1 is still beta, so if it works with 1.0.6 I would probably want to wait for an official release of 1.6.1 to address any issues.

@ghost
Copy link

ghost commented Mar 14, 2015

OK thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants