Hey guys,
I'm attempting to use a Microchip RN-52 bluetooth module with the Arduino Nano Every. I suspect the problem has to do with the ARM processor on the Every.
First off, datasheets
RN-52
RN-52 Library
My Code
#include <RN52.h>
RN52 rn52(2,3);
void setup() {
rn52.begin(115200);
Serial.begin(115200);
}
void loop() {
if (rn52.available())
Serial.write(rn52.read());
if (Serial.available())
rn52.print(Serial.read());
}
The goal is just to pass data from the RN-52 to my phone and vice versa.
The problem
First off I tried to just use Software Serial to make this happen over UART. (Still using UART BTW) and when I'd send data from the module to my phone I'd get erroneous data. For example I'd send an e and I'd get a d. I'd send a d and I'd get a d. Weird stuff like that. So my attempt to fix this issue was to use the RN-52 library.
However when I try to verify the code I get the following errors.
Arduino: 1.8.13 (Windows 10), Board: "Arduino Nano Every, ATMEGA328"
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp: In member function 'void RN52::begin(long int)':
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:315:7: error: 'digitalPinToPCICR' was not declared in this scope
if (digitalPinToPCICR(_receivePin)) {
^~~~~~~~~~~~~~~~~
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:315:7: note: suggested alternative: 'digitalPinToPort'
if (digitalPinToPCICR(_receivePin)) {
^~~~~~~~~~~~~~~~~
digitalPinToPort
In file included from c:\users\braeden\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\braeden\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\interrupt.h:38,
from C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:32:
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:356:44: error: 'digitalPinToPCICRbit' was not declared in this scope
*digitalPinToPCICR(_receivePin) |= _BV(digitalPinToPCICRbit(_receivePin));
^
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:356:44: note: suggested alternative: 'digitalPinToPort'
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:359:22: error: 'digitalPinToPCMSK' was not declared in this scope
_pcint_maskreg = digitalPinToPCMSK(_receivePin);
^~~~~~~~~~~~~~~~~
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:359:22: note: suggested alternative: 'digitalPinToPort'
_pcint_maskreg = digitalPinToPCMSK(_receivePin);
^~~~~~~~~~~~~~~~~
digitalPinToPort
In file included from c:\users\braeden\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
from c:\users\braeden\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\interrupt.h:38,
from C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:32:
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:360:28: error: 'digitalPinToPCMSKbit' was not declared in this scope
_pcint_maskvalue = _BV(digitalPinToPCMSKbit(_receivePin));
^
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:360:28: note: suggested alternative: 'digitalPinToPort'
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp: At global scope:
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:374:6: warning: always_inline function might not be inlinable [-Wattributes]
void RN52::setRxIntMsk(bool enable)
^~~~
C:\Users\Braeden\Documents\Arduino\libraries\RN52-master\RN52.cpp:119:6: warning: always_inline function might not be inlinable [-Wattributes]
void RN52::recv()
^~~~
exit status 1
Error compiling for board Arduino Nano Every.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
There's a lot going on there and I'm wondering if anyone has any ideas of what to do?