How to: RN52 programming and configuration (+video)

Next Topic
 
classic Classic list List threaded Threaded
48 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Seth
Administrator
This post was updated on .
Yes, you can force the rn52 to be in 9600 baud by shorting gpio7 to gnd.
Luckily, the pins are super easy to get to and do this with. Looking at the
bottom of the module, with th antenna up, the very bottom row of pins on
the rn52; you want to short the 2 left most pins. The first pin is gnd, the
next one over is gpio7.

How to short GPIO7 to GND
NC, USA
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

viv.g
Hey guys,

Is this still neccescary with the more recent boards?

I am in the final stages of setting up my V4.1.

Do I still need to go through and configure the RN52?
sbt
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

sbt
Viv,

I was just advised by Karlis to do this with my v5.0 board, so I wouldn't be surprised if the answer's yes. My version 5.0 did work without, but if you have any issues at all, I'd expect this will be the first set of steps you'd be expected to try.

I have more questions for Karlis though (following on from your comments in the software releases thread):

1) I have a reset button connected to the ATMEGA328 and the RN52. Does that do anything useful as far as the advice on page 1? I've assumed as the GPIO7 pin is already tied to ground on the v5.0 PCB, the 9600 baud issue won't arise at least.

2) I don't have an FTDI interface, only an Arduino which I used for programming via ISP. Can I use the RN52_FIRMWARE usb link to the RN52 module to run these commands, or do I need to work out how to use the Arduino?

3) The only wrinkle so far is that my phone while paired with the BlueSaab doesn't automatically reconnect when I turn on the IHU and select CDC. I thought it did originally, but that may have been misleading (while I was testing at home, I may not have gone out of range of the module with my 'phone). Would the setting for Discoverability help with this?

4) I already have a bluetooth module linked in with my TEL1 setup, so I won't be using the BlueSaab with the hands-free/mic option. I assume the commands on page 1 are still correct for this use case as this feature isn't enabled (yet)?

Thanks for your help with this.

Cheers,
Sam.
9³ 5D MY02 - Stålgrå, AS3; iOS 16.1; BlueSaab v5.0-p1+Amp v1.1, SAAB-CDC v4.1 with mods
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

viv.g
Hey Sam,

Just finished the process as you posted this.

I followed his tutorial, although I just connected via the main upload usb connection and uploaded the code through arduino IDE. (I used the code found here.

Pretty much just involved overwriting the BlueSaab code with the one posted and then loading up the serial monitor in the IDE and following the tutorial.

It should be noted that you must select the "Newline" option selected next to the baudrate setting to make it work using mac / arduino.

You should see the AOK message after changing setting to Newline from No Line Ending.

Hope this helps.

Viv

sbt
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

sbt
In reply to this post by sbt
sbt wrote
2) I don't have an FTDI interface, only an Arduino which I used for programming via ISP. Can I use the RN52_FIRMWARE usb link to the RN52 module to run these commands, or do I need to work out how to use the Arduino?
OK, I think I've answered my own question 2. The USB link is for firmware updates; doesn't appear to support command mode, based on my reading of the RN52 datasheet. So it's Arduino FTDI time...

Cheers,
Sam.

9³ 5D MY02 - Stålgrå, AS3; iOS 16.1; BlueSaab v5.0-p1+Amp v1.1, SAAB-CDC v4.1 with mods
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Seth
Administrator
Hey guys, yes, you HAVE to change the settings on the rn52 because otherwise some of the features like auto connect won't work. The rn52 will still stream music regardless.

Karlis is working on getting the BlueSaab code to change the settings of rn52 automatically but it's been finicky, so that's why it's still a manual process to change the settings by hand.
NC, USA
sbt
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

sbt
Seth,

OK, done. As my board has the GPIO7 ground tie, I assumed I could start from step 13, and this seems to have worked, based on the "D" command's report. Thanks to Viv, I tried using the UPLOAD usb port; this works - no FTDI interface needed. I assume this option limited to later/latest board versions, given Karlis's original tutorial.

I'll retest volume and auto re-connection after pairing tomorrow and report back.

Cheers,
Sam.
9³ 5D MY02 - Stålgrå, AS3; iOS 16.1; BlueSaab v5.0-p1+Amp v1.1, SAAB-CDC v4.1 with mods
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Karlis
Administrator
BlueSaab software relies heavily on *correct* (meaning non-default) RN52 settings.

For example:

*) "SS": output volume gain. Default 50%; changed setting 100%. Without this, the output volume of BlueSaab (even with the AMP installed) will be significantly lower than, say, volume in Radio mode.
*) "SD": discovery mask of RN52. Default "FF"; changed setting "06" (enable discovery via SPP and A2DP profiles only).
*) "SK": connection mask of RN52. Default "FF"; changed setting "06" (enable connections via SPP and A2DP profiles only).

In case of latter two, they are used for "auto-connect-play" of BlueSaab. Without them, the connection/auto-play can be flaky.

These are only a few but essential settings that we rely on.
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Karlis
Administrator
In reply to this post by viv.g
Starting v4.x (and above) boards, shorting of GPIO7 to GND is not necessary as it's already done on the PCB.
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Seth
Administrator
Good point on the GPIO7 pin, Karlis :) That pin is now hard-wired to GND on the pcb.
NC, USA
sbt
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

sbt
In reply to this post by sbt
sbt wrote
I'll retest volume and auto re-connection after pairing tomorrow and report back.
Results are in:

* volume is definitely better, as expected. I'm going to see if I can live without the amp module for now; I've got the volume on my phone way up; it's going to be interesting to see what happens when I get the next phone call;
* reconnection works fine on start-up. Playback starts once I turn on the IHU.

Thanks again to all for the prompt and helpful support!

Cheers,
Sam.
9³ 5D MY02 - Stålgrå, AS3; iOS 16.1; BlueSaab v5.0-p1+Amp v1.1, SAAB-CDC v4.1 with mods
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

NeilR
In reply to this post by Nickhe
I am able to upload the RN52-BT-PRG sketch to the 328 chip via an FTDI connection.  I have GPIO7 and GND jumpered on the RN52, so I skipped the steps that go back and forth between 9600 and 115200.  When I connected with minicom (using 9600 8N1) over the FTDI, I got the "RN52 programming mode" message (which comes from the sketch) but did not get the "CMD" response.  At one point, I noticed a wakeup() function in the code which was commented out.  I uncommented it because it seemed to pull a pin high and then low and print some messages while doing so.  I just wanted more verification that it was able to talk to the RN52 chip.  I uploaded that sketch, then I saw the "CMD" response along with messages about PWREN going high and low (part of the wakeup() function) and the "RN52 programming mode" message.  Even though I got the "CMD" response, I could not enter any commands.  Nothing was echoed to the screen and I did not get the "AOK" response.  Any ideas?

I measured 3.40V at the Vcc pin on the RN52. I am powering the board with 12V via the CDC connector, so I have the 3.3V lead from the FTDI disconnected.  I have the GND, TX, RX and RTS leads of the FTDI connected to the corresponding leads on the 6 pin header.  The BT1 and BT2 LEDs are alternately flashing and the power LED is on steady.  Is that what should be happening?
NC, USA; 1999 9-3 S, AS2; BlueSaab v3.2, software 4.1
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Karlis
Administrator
By default RN52 doesn't echo anything when you are typing something in. Try "D" or "V" (no quotes), this should give some output. Everything else seems to be ok.
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

NeilR
I forgot to mention that I tried D and did not get any response. I also forgot to mention that the DFU switch is in the Normal position.

  I just checked every connection on the RN52 by touching an ohmmeter to a pin on it and to the other end of the trace it was connected to just to make sure there isn't a bad solder connection causing issues.  Is the response "CMD" coming from the RN52?  If so, then that is a good sign that it is at least powering up OK and doing something.
NC, USA; 1999 9-3 S, AS2; BlueSaab v3.2, software 4.1
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Seth
Administrator
It sounds like you're ready to modify the settings on RN52 properly now. You might wanna make sure you send the "new" setting to the RN52 that enables SID text, while you have the program code going. This way when you upload the bluesaab code, you'll have SID text on an old module :)
NC, USA
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Karlis
Administrator
In reply to this post by NeilR
You are on correct path. "CMD" means that RN52 is on and is in command mode. The first line "RN52 programming..." is our custom message to know that the code has started. "CMD" actually comes from RN52 itself. So you are good to go!

The settings you will need are:

SN,<whatever name you want> (default BlueSaab)
SC,200420
SS,0F
SK,06
SD,06
S%,0084
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

NeilR
The problem is that I enter those commands and it returns nothing.  I, too, was hopeful when I got the "CMD" response.  :-)  After each of the SN, SC, SS, etc commands I should be getting a response back, correct?
NC, USA; 1999 9-3 S, AS2; BlueSaab v3.2, software 4.1
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Karlis
Administrator
You should be getting "AOK" or "ERR" as a reply. The fact you are not seeing any and are just seeing "CMD" leads me to think that something's broken on the Tx side from your terminal to RN52. As in RN52 doesn't get any commands so it doesn't reply to anything.
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

NeilR
In reply to this post by NeilR
I pulled the 328, connected pin #6 to pin #8 in the 328 socket (grounds GPIO9 of RN52), then connected my FTDI to the UART RX/TX connections and GND and powered up the board with 12V and plugged the FTDI USB cable into my computer.  I get CMD and AOK (good!), then several ERR/AOK pairs, then a steady stream of '?' characters and it does not respond to typed input from minicom (bad!).  If I disconnect the jumper between the 328's #6 and #8 pins, then I get an END message and the '?' characters stop.  I was basically following directions by @homerisback in the Uploading the Software post where he used an Arduino Uno to talk to the RN52 - I am trying to use the FTDI.  All the time I'm doing this, the BT1 and BT2 LEDs are alternately flashing.  Should they be flashing while the RN52 is in programming mode?  Do I need to connect any of the other FTDI pins (CTS, RTS) to the UART connection?

I also tried many different settings for flow control and such in minicom.  Some changes made the endless series of '?' stop, but still no response to commands.

Anyone have any brilliant ideas?  :-)
NC, USA; 1999 9-3 S, AS2; BlueSaab v3.2, software 4.1
Reply | Threaded
Open this post in threaded view
|

Re: How to: RN52 programming and configuration (+video)

Karlis
Administrator
OK, at this point I'd say "Pictures in the studio!"  I would like to have a look at the module.
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)
123