mbed LPC1768 project

classic Classic list List threaded Threaded
10 messages Options
Ziq
Reply | Threaded
Open this post in threaded view
|

mbed LPC1768 project

Ziq
This post was updated on .
Hello,

Since I'm not building on the 'original' platform created by Seth and Karlis I thought it would be appropriate to present what I have done so far.

I had an mbed LPC1768 lying around at work so I reused this and bought a RN52 breakout from Sparkfun and a CAN tranciever (MCP2551) and with a few cables and a breakout board hardware was done.

Current prototype:
Prototype

Update: Here is a list of the connections

I have a broken CD changer in my car so I'm planning to make a simple board and build it into the changer case so that everything will look original. I took the connector out of the cd changer and created a converter cable into dsub 9 so that I could sniff traffic in between with a usb-can device.

I started out with Karlis software and modified it some.
I have a Denso Nav unit (with broken touch) so some thing might differ for others (I have no audio information on the SID for instance) but almost everything should be general.

At the moment I can control the playback via steering wheel buttons and display messages on the SID.
I've not managed to upgrade the firmware on the RN52 yet (seems not to be compatible with Win 10) so I haven't implemented track metadata yet.

For software see here:
https://developer.mbed.org/users/petter/code/Saab-BT/

For a beginner I can really recommend the mbed LPC1768, it's not the cheapest but almost everything you need is on the board and you get basically everything you need with one include. The IDE is online so no installation is required. Flashing is done by dragging a file to the USB mass storage, and the unit is powered by USB . Debugging (printf) is also over USB so to use you actually need to install driver for the usb-serial interface, but no extra hardware/cables are needed.
Saab 9-5 2005 Nav
Building my own project based on mbed LPC1768 + RN52
Reply | Threaded
Open this post in threaded view
|

Re: mbed LPC1768 project

Seth
Administrator
Nice!!

So my only question would be, why did you need the can transceiver? It's my understanding that the LPC1768 supports CAN already...

In fact, I made the CombiAdapter using information from ECUProject.com and TrionicTuning.com, which is also based on the LPC1768. The software seemed over my head since I'm not a software guy, but I do remember uploading the code was super easy. The hardest part was having to buy the bootloader tool to upload the bootloader, but after that it was simple.

I have thought about using this chip in the future since it supports CAN out of the box, but I just wouldn't know where to start, software wise.

Give me a schematic, and I can make a pcb for it, though.......maybe it will be BlueSaab v4.0? :)

I actually did do a preliminary build of BlueSaab using the old, shitty BC05B bluetooth chip, but I intended on using a Teensy 3.0 board, which also supports CAN natively...maybe that is another way to go, but currently, the ATMEGA328 and dual CAN chips seem to be working fine...

Thanks for sharing :D
NC, USA
Reply | Threaded
Open this post in threaded view
|

Re: mbed LPC1768 project

Karlis
Administrator
In reply to this post by Ziq
Way to go Ziq, Nice work!

I don't think that's MCP2515 that your using, is it? :) Looks more like SN65HVD231DR transceiver...

Your code is nice and neat! So you are asking the SID for a permission to write on the 2nd row and then update it accordingly. How are you handling status changes of RN52? Do you query for status changes using "Q" command and then interpret the results somehow?

Thanks for sharing this!
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)
Ziq
Reply | Threaded
Open this post in threaded view
|

Re: mbed LPC1768 project

Ziq
EDIT: formatting disappeared due to re-login, fixed now!

Seth: the tranciever for CAN itself is seldom included, I guess it's due to the fact that there are different hardware layers that can be used for CAN (12V, 24V, RS485 etc.)

I updated the original post the connections I have so far. Since I plan to integrate the mic as soon as you guys have some success with it the design is not complete ;)

The reason I bought the Sparkfun breakout of RN52 was that I bought BC05B due to your previous recommendation, planned to solder some wires on it for first prototype but managed to destroy it =P

Karlis: You switched the numbers on the transceiver ;)

Well I had a good base to start with and thought if there should be different classes for the different modules they should not be dependent on each other, hence interaction is in the main loop. I would like to have communication interrupt-based in the future but then I have to figure out how to trigger software interrupts to trigger the main loop.. Right now my RN52 implementation is quite slow since I wait for response before continuing, I measured the time to 12-14 ms until I had the response but it seems to work. Right now it's -10°C outside and I haven't taken it for a drive in a couple of days so the SID extremely slow when I test so it's hard to really know at the moment...

I haven't actually tested the status handling properly, I'm a bit reluctant to work on it before I have upgraded the RN52 firmware. But you are right, I make the interpretation in RN52.get (RN52.cpp, row 77) and will take action needed in the end of my main loop.
Saab 9-5 2005 Nav
Building my own project based on mbed LPC1768 + RN52
Ziq
Reply | Threaded
Open this post in threaded view
|

Re: mbed LPC1768 project

Ziq
I couldn't resist looking more into event handling anyway! :D

I found that I read the hex response as ascii but needed the value for interpretation, I eventually found the neat function strtoul that handles that. I now have an elapsed counter that is triggered by playback! =D (I guess that is only of value for owners of a nav unit, you will try to overwrite this info anyway..)
Saab 9-5 2005 Nav
Building my own project based on mbed LPC1768 + RN52
Reply | Threaded
Open this post in threaded view
|

Re: mbed LPC1768 project

Da Bear
Nice!

Doesn't look to hard using the LPC1768. I feel like I want to do some experimentation to with this one, but using BC127 instead of RN52. Could be interesting with several hardware options :)
Saab 9-5 Aero MY01 AS3 - 270hp/240hp Biopower
Saab 9-5 SE    MY00 AS1 - 210hp+
Ziq
Reply | Threaded
Open this post in threaded view
|

Re: mbed LPC1768 project

Ziq
Yeah, the BC127 looks like a good alternative. I just upgraded my RN52 and I don't really like how it handles metainformation. It raises a flag that the information is available to read and I can request the information just fine. Then it turns out that it also sends the information directly without a request - which messes up the receive buffer. It's solvable but just simply annoying.. Then it also looks like people have problem getting the mic working with RN52, will have to look into that later.

I saw that sparkfun had a breakout for BC127 as well. Could be worth checking out if you would like to tinker a bit with it.

Working with the mbed is really neat. Since the IDE is online you can continue where you left it even if you switch computers. You even write a few lines on your phone while napping your kids if you like me have limited time to spend ;) I noticed though that sparkfun provides aurduino libraries for BC127 if you are lazy and don't want to implement the interface yourself =D

Saab 9-5 2005 Nav
Building my own project based on mbed LPC1768 + RN52
Ziq
Reply | Threaded
Open this post in threaded view
|

Re: mbed LPC1768 project

Ziq
Still a few glitches but it's shaping up!
Saab 9-5 2005 Nav
Building my own project based on mbed LPC1768 + RN52
Reply | Threaded
Open this post in threaded view
|

Re: mbed LPC1768 project

Karlis
Administrator
Looking really good! Keep up the good work! :) Can you tell what type of CAN message you are using for SID text? Is it SPA -> SID text control or anything else? Any flickering of SID observed?
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)
Ziq
Reply | Threaded
Open this post in threaded view
|

Re: mbed LPC1768 project

Ziq
Only flickering I've seen is for a few seconds after ignition is turned off. Had a bit of flickering before I implemented CAN filters to speed things up.

I'm sending a 0x348 (SID audio text control) in response to every 0x348 I get.

Since I have a NAV unit original 0x348 always says nothing should be displayed so I simply override this.

Then, with every 0x368 that grants the display I simply send my text in 0x328.

I guess you will have a 0x328 coming from the IHU as well, and the big question is if you are able to override it quick enough not to have any flickering. (I'd try responding 0x328 instead of 0x368).

At the moment polling seems to fast enough for me, but if you have the possibility to use interrupts that would be the best way to get fast enough responses. Since you have an external circuit I'm not sure how that would be implemented.

My metadata retrieval from the RN52 needs some work though, pretty sure I'm not reading it fast enough at the moment and missing input.
Saab 9-5 2005 Nav
Building my own project based on mbed LPC1768 + RN52