LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

vxlapi LIN

Hi,
first of all thanks for your job, i used your starting example for can communication to learn how to use this driver for can . I'd like, if possible something for LIN communication, i download your example but i didn't understand how it works can you help me with some easy example ?

Thanks in advance
Antonino

0 Kudos
Message 11 of 40
(2,304 Views)

Which part do you need help with?

The LabVIEW architecture, the LIN vxlapi functions or how a LIN network works?

 

There's plenty of LabVIEW training online, the app is basically a state machine.

The LIN vxlapi functions and the order they need to be called in are described in the Vector "XL Driver Library - Description.pdf" documentation.

A description of how LIN works can be found on wikipedia.

 

What the app does is described on it's front panel and in the comments on the block diagram.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 12 of 40
(2,292 Views)

Hello Troy,

 

how about sending LIN diagnostic frames (0x3C) from master to slave? If I take your LIN master transmit example and try to configure ID 0x3C with some data "xl Lin Set Slave" will fail with XL_ERR_WRONG_PARAMETER.


- Thomas -
0 Kudos
Message 13 of 40
(2,278 Views)

Hi Thanks for your attention,
At the end i was able to use the library for lin communications but i need to use it with a high baud rate 60K .
When i try to increase the baud rate i receive an error if the setting is higher than 30k.
The solution that my colleague implement is to set Transceiver Line Mode to "XL_TX_LMODE__SWC_FAST" before setting the baud rate, through the function "linActivateFlashMode()" that is available for CANoe, and i'm  not able to find this function or something similar in the dll, i found the Transceiver Line Mode.ctl but not a function that use this control.
Did you have any suggestion ?

Thanks in advance
Antonino

0 Kudos
Message 14 of 40
(2,256 Views)

Hello Thomas,

My Test VI didn't account for diagnostic frames. Diagnostic frames became part of the LIN protocol starting version 2.0 which also used enhanced IDs, except for the diagnostic frames, they still use classic. Solution is to modify the part of the code where the Master channel's DLC and checksums are defined.

If diag frames are specified, don't set the checksum type to enhanced...

 

DiagClassic.png(This is in the "Set Master" state.)

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 15 of 40
(2,228 Views)

Antonino27 wrote:  i need to use it with a high baud rate 60K ...When i try to increase the baud rate i receive an error if the setting is higher than 30k.

According to the vxlapi documentation "XL Driver Library - Description.pdf" > LIN Commands > xlLinSetChannelParams >

baudrate

Set the baud rate. e.g. 9600, 19200, ... The baud rate range is 200 … 30.000 Bd. Please note that the functionality of the XL API is guaranteed for 200 … 20.000 Bd according to the LIN specification. Higher values should be used with care.

 

So the API documentation says you can't do it.  Perhaps there are CANoe functions that exceed the capabilities exposed in the Vector XL API.  There I cannot help you. I've never attempted to use LIN faster than the protocol stated limit of 20KBd.

 

The xlCanSetChannelTransceiver function allows you to set the "lineMode" to XL_TRANSCEIVER_LINEMODE_SWC_FAST but there is no mention of linActivateFlashMode() in the documentation or header file.

 

http://vector.com/vi_news_detail_en,422739,,556439,detail.html says the function is available in CANoe 7.2 if you have the right hardware (VN8900 or CANcardXLe with suitable piggy).

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 16 of 40
(2,226 Views)

Hi,
at the end we started to use the standard baud rate but for our project we will need to use an higher rate, for these reasons we contact vector and they are going to delivery a new dll with this features the next year. This project needs a real time environments so we are thinking to develope our project with a pxi Phar lap OS . Do you know if is possible to use that dll with this Real Time OS ?

 

thanks in advanced

A.

0 Kudos
Message 17 of 40
(2,180 Views)

I haven't used it on a real-time OS yet myself but apparently you can check it using the NI tool found on this page:

How Can I Verify That My DLL Is Executable in LabVIEW Real-Time on NI PharLap ETS?

 

I tried to use it on version 9.0.34.0 of the vxlapi.dll, it ran for over an hour and the exe just kept consuming more and more memory until I killed it at 1.3GB.

Seems to be stuck in some sort of infinite loop with a memory leak.

 

Here's the report from and older version of the dll (6.7.60):

 

[BAD IMPORTS]
RegCreateKeyExA (RegCreateKeyExA)
RegEnumKeyExA (RegEnumKeyExA)
void * __cdecl operator new[](unsigned int) (??_U@YAPAXI@Z)
void __cdecl operator delete[](void *) (??_V@YAXPAX@Z)
__CxxFrameHandler3 (__CxxFrameHandler3)
CharLowerBuffA (CharLowerBuffA)
CharUpperA (CharUpperA)
CreateWindowExA (CreateWindowExA)
DefWindowProcA (DefWindowProcA)
DestroyWindow (DestroyWindow)
DispatchMessageA (DispatchMessageA)
GetClassInfoA (GetClassInfoA)
GetKeyState (GetKeyState)
GetMessageA (GetMessageA)
GetSystemMetrics (GetSystemMetrics)
GetWinStationInfo (GetWinStationInfo)
KillTimer (KillTimer)
LoadIconA (LoadIconA)
LoadStringW (LoadStringW)
MessageBoxW (MessageBoxW)
NotifyWinEvent (NotifyWinEvent)
PeekMessageA (PeekMessageA)
PeekMessageW (PeekMessageW)
PostMessageW (PostMessageW)
PostThreadMessageA (PostThreadMessageA)
RegisterClassA (RegisterClassA)
RegisterWindowMessageW (RegisterWindowMessageW)
SoundSentry (SoundSentry)
SystemParametersInfoW (SystemParametersInfoW)
UnregisterClassA (UnregisterClassA)
CheckForReadOnlyResource (CheckForReadOnlyResource)
CompareStringOrdinal (CompareStringOrdinal)
DelayLoadFailureHook (DelayLoadFailureHook)
FindResourceW (FindResourceW)
FreeResource (FreeResource)
GetPrivateProfileStringW (GetPrivateProfileStringW)
GetProfileStringW (GetProfileStringW)
GetTempFileNameW (GetTempFileNameW)
GetTempPathW (GetTempPathW)
GlobalHandle (GlobalHandle)
GlobalLock (GlobalLock)
GlobalReAlloc (GlobalReAlloc)
GlobalUnlock (GlobalUnlock)
LoadLibraryExW (LoadLibraryExW)
MulDiv (MulDiv)
OpenEventW (OpenEventW)
OpenFileMappingW (OpenFileMappingW)
SearchPathW (SearchPathW)
WaitForSingleObjectEx (WaitForSingleObjectEx)
_lclose (_lclose)
_llseek (_llseek)
_lread (_lread)
_lwrite (_lwrite)
lstrcmpW (lstrcmpW)
lstrcmpiW (lstrcmpiW)
lstrlenW (lstrlenW)
[STUBBED IMPORTS]
CreateProcessA (CreateProcessA)
FreeEnvironmentStringsA (FreeEnvironmentStringsA)
GetACP (GetACP)
GetCPInfo (GetCPInfo)
GetCurrentProcess (GetCurrentProcess)
GetCurrentProcessId (GetCurrentProcessId)
GetLocaleInfoA (GetLocaleInfoA)
GetOEMCP (GetOEMCP)
GetVersionExA (GetVersionExA)
IsValidCodePage (IsValidCodePage)
SetHandleCount (SetHandleCount)
SetUnhandledExceptionFilter (SetUnhandledExceptionFilter)
WriteConsoleW (WriteConsoleW)
RegCloseKey (RegCloseKey)
RegOpenKeyExA (RegOpenKeyExA)
RegQueryValueExA (RegQueryValueExA)
RegSetValueExA (RegSetValueExA)
IsWindow (IsWindow)
LoadStringA (LoadStringA)
PostMessageA (PostMessageA)
SendMessageA (SendMessageA)
SetTimer (SetTimer)
Beep (Beep)
GetACP (GetACP)
GetCurrentProcess (GetCurrentProcess)
GetCurrentProcessId (GetCurrentProcessId)
GetVersionExA (GetVersionExA)
MapViewOfFile (MapViewOfFile)
SetErrorMode (SetErrorMode)
SetUnhandledExceptionFilter (SetUnhandledExceptionFilter)
UnmapViewOfFile (UnmapViewOfFile)

You may have to just try it and see. The dll may not be the main problem. It may be the hardware driver that it accesses that will cause more problems.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 18 of 40
(2,171 Views)

 in vector driver (LIN vxlapi) common command-> structure -> xlbusparams function ,in that function available structure for all protocol except LIN . so i tried to use xlbusparams function and add structure for LIN to call  LinStatPar function and set baudrate but its still show baudrate 0 so i am not able to set LIN parameter through bus 

Did you have any suggestion ?

Thanks in advance

0 Kudos
Message 19 of 40
(953 Views)

Do you use the LabVIEW wrapper around vxlapi.dll? I ask because in the history of your post (i get an email everytime you modify your post) you once wrote something about Python. If you do not use LabVIEW at all I think it is better to seek support from Vector directly about how to use their API.

 

Anyway, to set LIN baudrate you need to call xlLinSetChannelParams and pass a XLlinStatPar struct.

 

Untitled.png

 


- Thomas -
0 Kudos
Message 20 of 40
(925 Views)