graphic panel 0x0 007 (hey there James!)

I’m just having some more time on a travel, so lets use it for some more content.
I’d like to introduce my gfx panel, with which I plan to handle my functions.
Since you can imagine, its much more easier to control your messages and functions with a graphical interface, than tiping code in a console er something.
so this is a working screen from my panel:

panel1
You will know, that you can create or modify panels with the ‚Panel Designer‘ (which is for instance be included with CANoe full version -> Tools Panel Designer)
The view from Panel Designer is pretty much the same, as its later on on the screen.
So how do we create a button, that is connected to a message in a CAPL node, we’d like to send via CAN?

It’s not that hard. Lets for example take the „ECU reset“, since this is a simple function.
– First of all, its important to create variables in CANoe, you will later link in the panel. Its really strong recommended from Vector, that you create well defined variables in tables (e.g. as system variables), because you might share your code with colleagues or even work on it together. If you just define variables somewhere in the code, it might get really confusing in the end.
ya da da, ya da da, you can read this whole stuff in the documents I linked in my „First Aid Section“, so no need I tell you)
To do so, go to CANoe -> Configuration -> system variables.
You can now add User-Defined variables.

systemvar1
Fill in a Namespace, e.g. „myCAPLmsgs“ and than name the variable in some kind you will know what they mean, for our example maybe „EcuReset“.
You can also edit your variable that it fits your needs. For a button, we just need an Integer (for an on/off button, no further values have to be set).
– go to a the Panel Designer and grab a button and drag it somewhere
– the most important thing now is, that you assign your button to the variable you defined.This can be done under the properties/symbol -> choose ‚System Variable‘ (the one you created before)
– now you can  connect your button to CAPL code: in CAPL browser:

on sysvar sysvar::Namespace::Name /* (Namespace + Name are the attributes of the system variable you defined before in CANoe) */
{
 SomeCodeToDoSomething;
}

You can load the panels after you created them via ‚Configuration -> Panels‘, and, if they’re already implemented in your configuration file via ‚View->Panels‘.

graphic panel 0x0 007 (hey there James!)

finally some working code 0x0006

today I solved one of my problems.

of course I will also provide you my solution. It was the simple question, how to write some data into a textfile for later analysis.

variables
{
byte buffer[1024];   // receive buffer for CAN-data via OSEK_tp.dll (1024 byte)
char StringLong[howeverlongyouneedit];  // for output string
dword glbHandle = 0;
}
OSEKTL_DataInd (long rxCount) /function to receive data via OSEK_tp.dll
{

[some code…]

OSEKTL_GetRxData( buffer, rxCount );
EmpfangAuswerten(rxCount);

[some code…]

}

/*with the OSEK function, we’re able to send and receive data directly to an addressed ECU. That said, if we do a diagnosis request to our ECU and read the memory by Address, the cells  of the memory are looking like this: Address: 0x0000, 0x0001, …. ; data: 0x00 … 0xFF. So this would be memory size of 1. We can handle this via a PDU command which looks like (naaah, I wouldn’t tell you, I guess its very specific, lets just say its looking like) 11 22 00 00 01 00 01, where some of the fields gives us the address (e.g. 01 00 = #256) and the „01“ at the end a memory size of 1.*/

/*[send a Request to ECU – read memory – e.g. 4 cells Memory]
[receive Response – e.g. 00 01 02 01] ; response is written in „buffer“*/
glbHandle = openFileWrite („testreport.txt“,0);

/* Format and store the data */
snprintf(StringLong, elcount(StringLong), „bufferdata: %02X … %02X\n“,buffer[1], buffer[2], …, buffer[i]); //in this case i = 4

/*I did it the way that the number of „%02X“ equals number of „i“ — which is veeery complicated when you want to read >> 100 byte) */
filePutString (StringLong, elcount(StringLong),glbHandle);
fileClose(glbHandle);

finally some working code 0x0006

a solution? 0x0005

alternative title: the internet is a treasury

yesterday I found a document in the internet with a bunch of code, that looks pretty much like the things I’m planning.
The title from the file is „Codigo del Proyecto“ which is spanish I assume and just means „project information“. It contains just code for a CAPL-Node
„X10_Tester.can“. So nobody I can praise, ask for permission or whatever. I’m okay with that 😉 Since it was found in Google, I think it is okay, to upload it here (whoever did the coding: thanks anyway!)

Codigo del Proyecto

As we see from the Node-title, it would likely provide us some information about tester functionalities. Which is pretty damn cool, since I’m also planning to do a tester/diagnosis node for my simulation.

Go with the file, I leave it uncommented so far (I’m far from understanding everything).
Its too big, to copy the code to our blog.
Maybe some lines are helpful.

I’m personally trying some of the filePutString-things so far for me, because for my string they’re not working at the moment:

void filewrite_C()  
/* this function is used somewhere else to process a string is written into a file */
 {
 glbHandle = OpenFileWrite ("report123.txt",0);
 if ( glbHandle!=0 )
 {
filePutString (buffer, elcount(buffer),glbHandle);
 fileClose (glbHandle);
 }
 }
ERROR: types of parameters do not match.
buffer: initalisation see below:
variables
 {
 byte buffer[1024]
 }

and than used in an OSEK transport function (more soon).

a solution? 0x0005

a problem 0x0004

ok, lets see what we got.

First of all, lets have a look on my Simulation Setup:

configuration

you see its very simple,

  • a (our) component (=ECU), which is disabled at the moment (this was one of the first and the best shortcuts I ever learned in CANoe, selecting a node pressing ‚SPACE‘ bar to activate/deactivate) due to the reason that I use a real component with same behavior on my desk,
  • a node for all of the rest of car functions and
  • a diag-node (the one we want to design and implement in CAPL code) which will provide us some diagnosis functions and I/O control with a graphic panel

So just straight to my biggest problem at the moment, before I will briefly describe some other code:

A .cdd file (CANdela file) describes diagnosis services you can do with a component. In my case one service is that you read the internal memory by address. (ReadByAddress). This service would be quite useful in reading the whole memory, which is a function I want to realize.

Now the difficulty: this service is just defined with a memory size of max 256 bytes. memory contains about 20 times this seize. How to read memory with this function? I thought about doing some loops or a request after a request, but after all, it seems not be that easy..

For this I asked Vector support, and the answer was either doing some state machine, or defining a test module (which I heard and read something about, but can not do it right now). The propose was to use some code like its in the example „Diagnostics\UDSSim\Tester\Download.cin“… well.. fine.

 

 

 

a problem 0x0004

mind the gap

I’m still very existed about my new blog but I’m afraid today isnt enough time to provide some more input.

So i will just upload 4 files I currently used in my actual project (at least more or less) and we will talk about it later this week (by any chance on Wendnesday I guess :] ).

AN-IND-1-001_CANoe_CANalyzer_as_Diagnostic_Tools

AN-IND-1-002_Testing_with_CANoe

AN-IND-1-012_CAPL_Callback_Interface

SN-IND-1-015_CANoe_CANalyzer_Padding_DiagnosticFrames

(all provided and copyright by Vector)

See you R

mind the gap

keep the pace

So yesterday was a quite successful day (not only in personal, recover from a cold) but specially for my BLOG. I got the first follower (cheers @seppolog) which was made me thinking „woohoo“ when I logged in on wordpress today.

So no need in slowing down now 😉 I hope if I’m looking at this screen in one year, there will be hundreds of blogentrys (ok lets be realistic, I think 2-3 per week would be fine).

So first of all I’d like to talk about the work I’m doing right now. as you can see in my ‚About‘ I’m in the automotive industry, I’m closely connected to one electronic control unit (ECU) as one component of the whole car-architecture. Some device from the field of telematics.

As my company supplies this component to an OEM, my job is to keep it running at customers side. Therefor, future tasks (in timeline, we have still way to go to series prodcution) are much about analysing the behavior, specially when there are errors detectet.

Which programm could be more useful in the car architecture environment as Vectors CANoe? (I guess none?). Anyway, I will have to deal with it (and its quite interesting).

So this are the facts for my first (and guess more ore less all-time) project:

  • running CANoe full license 8.2. which connects me to CAN architecture via VN1610 CAN device
  • different residual bus simulations, created by colleagues, the customer or others – describing the behavior of the whole car, or important parts that interact with our device
  • one simulation I created on my own (basically I will work on that one, but the others were quite useful to understand how some things are done)  – created with Vectors Model Generation Wizard (for me it was just organizing some files, reading a document and pressing some buttons, so nothing I could ever write about). In fact I think that the MWG is a really cool add-on from Vector (if you know what you’re doing ;))
  • a CANdela .cdd file, with could be included, and with which diagnosis of the component is possible
  • a device on my table

Soon I’m gone provide you finally some code (I will try to remember how I started, to have a realistic impression on my CAPL journey – since than I improved a bit, but not that much I guess ;p)

keep the pace