/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Need help with setting up a LIN-connection

Username:     
Password:     
             

Forum

# 1   2010-12-15 10:41:50 Need help with setting up a LIN-connection

Reckan
New member
Registered: 2010-12-13
Posts: 6

Need help with setting up a LIN-connection

Heya!

I am really new to programming microcontrollers and using Ride7 plus transferring things so please bare with me if things sounds too stupid smile

Im currently working on a project where i have a device controlling a motor moving a metalpiece from pointA to pointB. This device is built on a STM32F101C6T6. I want this device to send some kind of confirmation to my primer2 via LIN that now the metalpiece is in pointA (or now its in pointB). Lets say that when it's in pointA, i want a simple application using the CircleOS, to just light up the touchscreen green. And when it's in pointB the screen should be red.

I know how to write the application with filling up the screen with different colours since thats not really hard. Instead, the tough part for me is to set up the LIN-connection in both devices since ive never EVER transferred things between devices like this before.

The only pins left that i think i can use on my STM32F101C6T6 is 29-33(PA8-PA12) since they have UART?

I kinda know what to do, but i have no idea how to put it down in code if you get what i mean.

I have read some other projects here on the forum and also checked out examples but i just get confused.

If someone could help me with writing a mini tutorial on how to write this code or help me with some parts i would appreciate it so much! Ive been stuck for some days now and i wanna move on!

Thanks so much for your time and help!
//Reckan

Offline

 

# 2   2010-12-15 12:44:10 Need help with setting up a LIN-connection

mikepo
Member
From: USA
Registered: 2010-12-03
Posts: 36

Re: Need help with setting up a LIN-connection

Hi,
do you have to use LIN for the communication?
If you have only these 2 bits to transfer, then you could just use 2 GPIO pins to transfer the data. or use a serial/UART connection.
Depending on the length of distance to cover that may be working for what you need.
Does the other device already have a LIN implementation? You say it is based on STM32F101C6T6, so if you have access to the source code for that, maybe you can see how the LIN implementation is done. Or look into using a dedicated LIN transceiver chip.
Hope that helps a bit ....

Offline

 

# 3   2010-12-15 13:17:48 Need help with setting up a LIN-connection

Reckan
New member
Registered: 2010-12-13
Posts: 6

Re: Need help with setting up a LIN-connection

hello mikepo and thanks for your reply!

I can use a UART connection aswell, that would work pefectly and the distance is not a problem in this project. I guess that's a "easy" solution?

I know how to set up GPIOs because i have some buttons and diodes on the other device (based on STM32F101C6T6) but ive never worked with UART. I guess thats my biggest problem at the moment smile

I also dont know which addon pins to connect to on the primer2? (i dont have the external board to connect to)

Thanks once more!
//Reckan

Offline

 

# 4   2010-12-15 14:03:53 Need help with setting up a LIN-connection

mikepo
Member
From: USA
Registered: 2010-12-03
Posts: 36

Re: Need help with setting up a LIN-connection

In the "STM32-Primer2 user manual", page 9 (http://www.stm32circle.com/resources/stm32primer2.php) is the pinout of the extension connector. So pin 16 and 18 seems to be the TX/RX pins for usart2.
I have not used it myself, but here is another post that might help using USART2 from the extension connector:
http://www.stm32circle.com/forum/viewtopic.php?id=1160

Last edited by mikepo (2010-12-15 14:04:11)

Offline

 

# 5   2010-12-15 14:18:13 Need help with setting up a LIN-connection

Reckan
New member
Registered: 2010-12-13
Posts: 6

Re: Need help with setting up a LIN-connection

Thanks again for a fast reply! smile

So basically i can copy the code from johnyo but replace his ini code with the one from logictechs post? And then the primer2 part should be done?

//Reckan

Offline

 

# 6   2010-12-15 17:36:03 Need help with setting up a LIN-connection

mikepo
Member
From: USA
Registered: 2010-12-03
Posts: 36

Re: Need help with setting up a LIN-connection

"Theoretically" yes smile
It would be good to be able to debug this. If you have a usb_>TTL serial cable you could hook that up to your PC and the primer and then open a serial terminal on the PC and test out if it works, i.e send a command from the PC to your device and make the screen blue or something. If I get a chance I'll try that out over the next days, but I can't promise anything.
I still have a CA-42 cable laying around that should work for this:
http://www.uchobby.com/index.php/2009/1 … ble-for-3/
You can get them pretty cheap on EBay if you don't have another USB->TTL Serial cable.

Last edited by mikepo (2010-12-15 17:38:10)

Offline

 

# 7   2010-12-15 17:50:18 Need help with setting up a LIN-connection

Reckan
New member
Registered: 2010-12-13
Posts: 6

Re: Need help with setting up a LIN-connection

Hey again

No i dont have that type of cable.. im sorry!
And dont worry, you dont have to try anything out unless you really really want to tongue

Ill figure it out somehow! I also got some more help from Yves! Otherwise ill just come back online tomorrow again!

Thanks for all your help mikepo!
//Reckan

Offline

 

# 8   2010-12-28 05:44:50 Need help with setting up a LIN-connection

mikepo
Member
From: USA
Registered: 2010-12-03
Posts: 36

Re: Need help with setting up a LIN-connection

Hey Reckan,
did you ever get this to work?
I finally got a simple USART sample application working, which uses interrupts for send/receive of data in case you're interested.
Project link is in this thread: http://www.stm32circle.com/forum/viewtopic.php?id=1328

Offline

 

Board footer