EmbeddedRelated.com
Forums

LIN on LPC2129

Started by alberto March 29, 2006
Hi guys,
Has someone developed a Local interconect network on LPC2129?
There is somewhere a simple LIN stack?

Thanks in advance

Alberto

Yahoo! Groups Links

An Engineer's Guide to the LPC2100 Series

On Mar 29, 2006, at 8:37 AM, alberto wrote:

> Hi guys,
> Has someone developed a Local interconect network on LPC2129?
> There is somewhere a simple LIN stack?

The LPC2129 is not able to do LIN with its UART unless you use other
pins and glue logic to be able to generate the BREAK signal (13 bits)
and implement an auto-baud detect. I suggest you program a PIC16F690
with a simple SPI or I2C LIN stack that will interface with your LPC.
The PIC16F690 contains all the necessary peripherals and is a very
small footprint.

Best Regards,

Tennessee Carmel-Veilleux

Yahoo! Groups Links
Hello,

There is a simple tip to generate the 13-bit break without having to implement
external glue logic. The LIN bus operates at know (an relatively low)
bitrates.

The idea is to change the value of the prescaler that defines the baudrate in
the UART. You can calculate a "virtual" baudrate that make an eight-bit long
0x00 byte as long as 13-bits at the nominal LIN bus bitrate.

After the break has been sent, you can switch back to the normal prescaler
value for the LIN bus speed and go on with the rest of the frame. I Haven't
checked if the prescaler settings possible with an LPC2129 allow this with
enough accuracy to mach the constraints of the LIN spec, but I think it
should work.

This was used in the very first implementations of the LIN protocol, when
LIN-compliant UARTs (like in the 16F690) were not yet available. I Remember
examples in old appnotes from Infineon on their C167 controller. Probably
this is still available on their website.

Hope this can save extra hardware ... which represents money !!

Regards

"Duke"

Le Mercredi 29 Mars 2006 23:20, Tennessee Carmel-Veilleux a rit :

> On Mar 29, 2006, at 8:37 AM, alberto wrote:
> > Hi guys,
> > Has someone developed a Local interconect network on LPC2129?
> > There is somewhere a simple LIN stack?
>
> The LPC2129 is not able to do LIN with its UART unless you use other
> pins and glue logic to be able to generate the BREAK signal (13 bits)
> and implement an auto-baud detect. I suggest you program a PIC16F690
> with a simple SPI or I2C LIN stack that will interface with your LPC.
> The PIC16F690 contains all the necessary peripherals and is a very
> small footprint.
>
> Best Regards,
>
> Tennessee Carmel-Veilleux
>
> YAHOO! GROUPS LINKS
>

Yahoo! Groups Links
On Mar 29, 2006, at 5:11 PM, Duke Whisky wrote:

> Hello,
>
> There is a simple tip to generate the 13-bit break without having to
> implement
> external glue logic. The LIN bus operates at know (an relatively low)
> bitrates.
>
> The idea is to change the value of the prescaler that defines the
> baudrate in
> the UART. You can calculate a "virtual" baudrate that make an
> eight-bit long
> 0x00 byte as long as 13-bits at the nominal LIN bus bitrate.
>
> After the break has been sent, you can switch back to the normal
> prescaler
> value for the LIN bus speed and go on with the rest of the frame. I
> Haven't
> checked if the prescaler settings possible with an LPC2129 allow this
> with
> enough accuracy to mach the constraints of the LIN spec, but I think
> it
> should work.

You are absolutely right. I am sorry about that :) I remembered the
break character being a toggling 12 bits + start, but I was wrong. The
break is 12 bits of '0' + start and the SYNC is 'U' (10101010 on the
line). One of my colleagues is working on a LIN master co-processor
using a 16F690 to offload the work from my LPC2129 and also to be
reused by other MCUs. That's why I had it in mind. I guess I should
have better checked my facts. Thanks for bringing-up this solution ! I
have actually used a similar solution for RS-232 arbitration (special
start condition) on another project and didn't even remember it !

Best Regards,

Tennessee Carmel-Veilleux

Yahoo! Groups Links
--- In l..., Duke Whisky wrote:
>
> Hello,
>
> There is a simple tip to generate the 13-bit break without having to
implement
> external glue logic. The LIN bus operates at know (an relatively low)
> bitrates.
>
> The idea is to change the value of the prescaler that defines the
baudrate in
> the UART. You can calculate a "virtual" baudrate that make an
eight-bit long
> 0x00 byte as long as 13-bits at the nominal LIN bus bitrate.
>
> After the break has been sent, you can switch back to the normal
prescaler
> value for the LIN bus speed and go on with the rest of the frame. I
Haven't
> checked if the prescaler settings possible with an LPC2129 allow
this with
> enough accuracy to mach the constraints of the LIN spec, but I think it
> should work.
>
> This was used in the very first implementations of the LIN
protocol, when
> LIN-compliant UARTs (like in the 16F690) were not yet available. I
Remember
> examples in old appnotes from Infineon on their C167 controller.
Probably
> this is still available on their website.
>
> Hope this can save extra hardware ... which represents money !!
>
> Regards
>
> "Duke"

That is a very clever solution! I am not concerned about LIN but
there is an awkward start condition for the DMX protocol used for
stage lighting. I'll have to remember this.

Thanks
Richard

Yahoo! Groups Links
Another way to generate non uart style serail data streams is to use a
timer and a compare unit.

This makes a hardware assisted bit bang type system. You program the
compare module to put out a high or low as required, then make it
generate an interrupt. In the isr you set the same compare module to
drive the next bit.

The benefit of using the compare module is that the edges are output
with perfect timing and you have quite a while to setup the next bit.
Unlike classic bit bang you can easily do other things at the same
time and it is nohwere near as compute intensive.

If you can dedicate a whole timer then you can get the compare to
reset the timer so you do not have to keep calculating a new time for
the compare unit.

If you want higher data rates then this can be done by allocating the
timer you are using to the FIQ and making use of the special FIQ
registers (so you do not have the overhead of stacking and unstaking
the used registers).

This techniquie is very useful on chips like the LPCs which are pretty
fast and have a low interrupt latency and can have VERY short isr
routines.

Yahoo! Groups Links
Hy guys,
thanks to all ones.I'm thinking to use LPC2129 as LIN master and
CANopen gateway, and a PIC16F76 as LIN slave on little keyboard module.
My problem is have some lin sw examples to understand the protocol.
I read the LIN2.00 spec but it isnt clear specially on slave
diagnostic/configuration part.
I have a CANOPEN stack written for PIC18F458, I have to port it on LPC
platform.
Someone has a similary experience?

thanks a lot

Yahoo! Groups Links