BT serial connection info

This forum is for the discussion of other projects on Megasquirt/Microsquirt hardware that don't fit into any of the other forums

Moderators: jsmcortina, muythaibxr

Post Reply
Keithg
Super MS/Extra'er
Posts: 2413
Joined: Sun Mar 06, 2005 9:15 am
Location: Chicago, IL, USA
Contact:

BT serial connection info

Post by Keithg »

I guess this belongs here. I recently bought a BlueSMirf BT module to try out here with my MS2.

http://www.sparkfun.com/commerce/produc ... cts_id=158

It defaults to 115k n81, so it is default set for MS2. I got it linked and working yesterday, but could not connect with MT. It turns out that my COM port that was setup was too high and MT could not use it. I reset it to COM2 and all seems well.

There is a lot of confusing info on these modules, at least for me. Here are the basics.
1) I was not able to flash via the BT connection. You will still need a cable to flash and in this case, you will have to re-socket the MAX232 to do so.
2) You will want to 'pair' the BlueSMirf with your computer or BT dongle so that it will always 'just connect' when the MS powers on. This is not the only way, but you get fast serial and once paired, it will always pair. This is called Master Auto mode.
3) you need to short CTS/RTS. You can do this by soldering a wire between the holes on the module, or a short between the pads on the back side. Regardless, it needs to be shorted at the module to work.
4) I was not able to figure an easy way of allowing both the serial and the BT to live together, so I socketed the MAX232 and made an adapter to be able to plug the bluesmirf on the pins 16,15,12,11 of the MAX232 socket. There is another post on the Miata net where a guy used a different module and was able to force 'pass thru' on the BT to allow the serial to live, I have not done this.
5) It may be helpful to temporarily solder a short wire (6") to the pin PIO4, pin 22 if you need to 'reset' the device. To do so, you will need to power it up with this wire held on pin 11 (3.3V) then connect/disconnect 3 times to reset it. It would be *much* easier if SF had a jumper for this...

This is how to do it: Once you get the BT module connected to the MAX232 plug and TX from the MS to RX on the BlusSMirf and RX on the MS to TX. Power it up and it should start flashing. Open the BT Devices in XP Control panel. Turn Discovery on, and click on 'add device'. You will see the BlueSMirf show up as a FireFly. Click it, set the pass code to 1234 (As per the RN-41 docs), it should authenticate and be OK. Then get the terminal program http://www.lynxmotion.com/Product.aspx? ... egoryID=15
I was not able to make hyper term work and needed this. Set the com port settings to the com port that showed up in the BT settings with "spp" after it to be 115,8,1,n,n. Also set the other parameters according to this
Image

You should be able to talk to the BlueSMirf via BT, now.

Now power cycle the BT module and click 'connect' in lynx term. You must do this in the first 60 seconds after it boots to be able to 'configure' it
Type: $$$ to get the command prompt to set it up
Type: I,30 and return
It should show your BT dongle mac address. If only one is showing, you can
type SR,I and it will store the mac address of your computer/dongle. Otherwise, you need to type the address string as it shows in the manual:
Type : I,30<cr> // Looks for Bluetooth devices
Reply:<cr>00A096112233,00000104,RN-112233<cr>DONE<cr
Now, store the remote address just found.
Type : SR,00A096112233 <cr> // this is the mac address of the computer/host
Reply:<cr>AOK
Type: SM,3 Now you need to set it as 'auto connect master' mode. This way, it will power up and look to connect to the computer every time it powers up.

Now, I deleted the BT configuration I had previously for the FireFly and clicked on ADD again. This way, it is broadcasting as a serial connection and I set up the com ports again. The only other thing is that you need to make sure that the com port is low enough, numerically, to work with MT. TS does not care, but mine was COM14 and MT could not see it even if I had it selected in the comms settings. I had to move it to COM2 and it works in both TS and MT. You do this in the Device manager, Advanced settings.

I am sure I forgot something, but thought I'd post this now before I forget.

KeithG
pigga
Master MS/Extra'er
Posts: 618
Joined: Sat Feb 09, 2008 12:44 pm

Re: BT serial connection info

Post by pigga »

Hi Keith!
Good idea that you dig out the old BT+Megasquirt-Story.
Just one Question: You said "I was not able to flash via BT". Do you mean the configuring of the BT module, or do you mean ubgrading the MS firmware or even the "burn to controller"-option while configuring the ms?
I bought a socketcom BT adaptor a long while ago, as it had been tested by B+G in their documentation and they wrote it would work fine.
I really, really tried around quite a lot with it but finally suffered :-(
Actually I am wondering if this could work with linux as well?
Thomas
Keithg
Super MS/Extra'er
Posts: 2413
Joined: Sun Mar 06, 2005 9:15 am
Location: Chicago, IL, USA
Contact:

Re: BT serial connection info

Post by Keithg »

Yes, by 'cannot flash' I meant I was not able to flash a new s19 to the MS via BT. I initially connected to the BT module via BT in order to configure it (set its mate and set it as master).

I read about that 'socket' BT and it should work no problem. I dunno about Linux, but that should already be developed as well. All it needs is an appropriate BT stack in Linux.

Keith
Marc D
MS/Extra Newbie
Posts: 25
Joined: Tue Oct 06, 2009 12:21 am

Re: BT serial connection info

Post by Marc D »

Sorry to bring up such an old post.

Keith, I'm curious, how did you wire up the BT unit? Im going to be using Bluegiga's BT unit, and although it generally looks the same, I'm sure there's some differences in physically connecting the thing.
Keithg
Super MS/Extra'er
Posts: 2413
Joined: Sun Mar 06, 2005 9:15 am
Location: Chicago, IL, USA
Contact:

Re: BT serial connection info

Post by Keithg »

Marc D wrote:Sorry to bring up such an old post.

Keith, I'm curious, how did you wire up the BT unit? Im going to be using Bluegiga's BT unit, and although it generally looks the same, I'm sure there's some differences in physically connecting the thing.
Wired 12V, gnd, out to in and in to out. 4 wires. You need to make sure that the send of the MS is connected to the receive on the module and vice versa.

KeithG
Marc D
MS/Extra Newbie
Posts: 25
Joined: Tue Oct 06, 2009 12:21 am

Re: BT serial connection info

Post by Marc D »

did you need to sever the lines from RX and TX? Similar to installing the USB RXTX Module? I guess i should be really asking tech support from the USB module manufacturer, but you seem to have it down. I wasn't sure if the MAX232 chip will need to be utilized.

Also, I guess I should mention, that the specific module I'm using cant use 5V, it only works at 3.3V, so I have to use a LD1117, or a similar component to provide power. And to boot, it can't use the MAX232, but only a MAX3232 chip.

Sorry for all the dumb questions, I just wish I knew more about TTL and logic levels.
Keithg
Super MS/Extra'er
Posts: 2413
Joined: Sun Mar 06, 2005 9:15 am
Location: Chicago, IL, USA
Contact:

Re: BT serial connection info

Post by Keithg »

Marc D wrote:did you need to sever the lines from RX and TX? Similar to installing the USB RXTX Module? I guess i should be really asking tech support from the USB module manufacturer, but you seem to have it down. I wasn't sure if the MAX232 chip will need to be utilized.

Also, I guess I should mention, that the specific module I'm using cant use 5V, it only works at 3.3V, so I have to use a LD1117, or a similar component to provide power. And to boot, it can't use the MAX232, but only a MAX3232 chip.

Sorry for all the dumb questions, I just wish I knew more about TTL and logic levels.
I did not use the max232.

Instead of severing the lines, I used a trick that James passed me about using a diode bridge to make sure that the input only comes from one of the other (serial or BT) this way you can still flash the code. BT can be used to flash it, but it is way too slow to be of use.

I think James should post that png so that all can see how to do this. It is very slick and allows you to have both interfaces. I have not used BT in a while b/c I have been playing with other stuff. When I use it, it is pretty cool not to have a cable.

Keith
Marc D
MS/Extra Newbie
Posts: 25
Joined: Tue Oct 06, 2009 12:21 am

Re: BT serial connection info

Post by Marc D »

Now thats an interesting development for me.

The module that I purchased happens to have a UART bypass command, which basically lets the data flow out of the module transparently. It just required a simple command to the bluetooth module, then to bring back the module to its original settings, it just needs a hard physical reset, or the push of a button from the outside of the MS box.

I have a somewhat completed documentation on another forum (miataturbo.net - http://www.miataturbo.net/forum/t39397/ ) on setting up this bluetooth module, but it required severing the RX and TX lines to the MS processor. I did the write up a few months ago, but I never got around to installing it.

I was also curious, did you use any hardware flow control? I was recommended by the chip manufacturer to use HW Flow control because of the possibility that the unit may hang when the buffer overflows - and sadly, the buffer is only 500 Bytes.

EDIT: Nevermind, i just saw that no hardware control should be implemented at all per se megamanual instructions for connection.

I wonder if James would chime in on this thread, I'm interested on how the diode bridge would work.
AbeFM
Super MS/Extra'er
Posts: 875
Joined: Wed Dec 05, 2007 1:40 pm
Location: San Diego, CA
Contact:

Re: BT serial connection info

Post by AbeFM »

Keithg wrote:Instead of severing the lines, I used a trick that James passed me about using a diode bridge to make sure that the input only comes from one of the other (serial or BT) this way you can still flash the code. BT can be used to flash it, but it is way too slow to be of use.

I think James should post that png so that all can see how to do this. It is very slick and allows you to have both interfaces. I have not used BT in a while b/c I have been playing with other stuff. When I use it, it is pretty cool not to have a cable.
I second that vote: I'd love to see how to get the functionality of both!
2000 VVT Miata turbo, MS3Pro

Contact me if interested in a MS-II 2nd gen NB Miata PnP board.
dontz125
Super MS/Extra'er
Posts: 4200
Joined: Mon May 11, 2009 7:14 pm
Location: York, ON
Contact:

Re: BT serial connection info

Post by dontz125 »

Wow - time for a meeting of Necrothreads Anonymous! :lol:

Interestingly enough, a fellow JUST posted such a sketch in a different thread. I don't know if this is the one that James' sent to the earlier poster, but it would seem to work. The other option of course to prevent corruption when flashing is to power off your BT while the USB / serial cable is connected.
QuadraMAP Sensor Module -- PWM-to-Stepper Controller -- Dual Coil Driver
Coming soon: OctoMAP Sensor Module
TTR Ignition Systems
Keithg
Super MS/Extra'er
Posts: 2413
Joined: Sun Mar 06, 2005 9:15 am
Location: Chicago, IL, USA
Contact:

Re: BT serial connection info

Post by Keithg »

No, that is not the schematic I used. I believe the pertinent schematic copied is actually on the MS3 daughter card schematic. I would send a copy that James sent me a long time ago, but do not want to pass on something that James does not want passed. If it is ok'd by the moderators, I can pass it on. I think it would be helpful for the community.

Keith
dontz125
Super MS/Extra'er
Posts: 4200
Joined: Mon May 11, 2009 7:14 pm
Location: York, ON
Contact:

Re: BT serial connection info

Post by dontz125 »

Keithg wrote:I believe the pertinent schematic copied is actually on the MS3 daughter card schematic.
Without being a smartass, when did you see a copy of the MS3 schematic?! That's even more closely guarded than the MS3 processor monitor code. :shock:
I would send a copy that James sent me a long time ago, but do not want to pass on something that James does not want passed. If it is ok'd by the moderators, I can pass it on. I think it would be helpful for the community.
Would you be willing to send him a PM inquiring about this, if he doesn't post here in a day or three?
QuadraMAP Sensor Module -- PWM-to-Stepper Controller -- Dual Coil Driver
Coming soon: OctoMAP Sensor Module
TTR Ignition Systems
Post Reply