Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

LIN on LPC2129

LIN on LPC2129

2006-03-29 by alberto

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

Thanks in advance

Alberto

Re: [lpc2000] LIN on LPC2129

2006-03-29 by Tennessee Carmel-Veilleux

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

Re: [lpc2000] LIN on LPC2129

2006-03-29 by Duke Whisky

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 écrit :
Show quoted textHide quoted text
>  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
>
>
>  Visit your group "lpc2000" on the web.
>  
>  To unsubscribe from this group, send an email to:
>  lpc2000-unsubscribe@yahoogroups.com
>  
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

Re: [lpc2000] LIN on LPC2129

2006-03-30 by Tennessee Carmel-Veilleux

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

Re: LIN on LPC2129

2006-03-30 by rtstofer

--- In lpc2000@yahoogroups.com, Duke Whisky <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

Re: LIN on LPC2129

2006-03-30 by fordp2002

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.

Re: LIN on LPC2129

2006-03-30 by alberto

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

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.