Problem in Drivers installation under Linux-Kernel 3.2.0

This forum covers PCAN-Linux and Linux development issues concerning our products
matteo
Posts: 13
Joined: Wed 13. Aug 2014, 17:29

Re: Problem in Drivers installation under Linux-Kernel 3.2.0

Post by matteo » Wed 20. Aug 2014, 20:14

ok, now, with the API guide, i'm getting a little bit better. I thought I was supposed to find everything on the linux guide.
Btw, what dou tou mean for "fake"??

Code: Select all

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20140723_n (7.12.0) Aug 13 2014 18:20:29 --------------
*---------------- [mod] [isa] [pci] [dng] [par] [usb] [pcc] -----------------
*--------------------- 1 interfaces @ major 250 found -----------------------
*n -type- ndev --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32    usb -NA- ffffffff 255 0x001c 00000000 00000000 0000010c 00000000 0x0000
is exacly the output of my system....nothing faked.


Ps.

Code: Select all

m s 0x000002d0 6  0x01 0x01 0x00 0x01 0x00 0x00              516492425 570
comes out after the change of the baudrate (that i did also previously, but it seems that i have to do it everytime i call cat /dev/pcan32)...still i don't understand what these "m s" are...at the position where the message ID is supposed to be written.

Also here

Code: Select all

x x 0x00000000 4  0x00 0x00 0x00 0x08                        155466769 065
, according to the API guide: what is x x?
should 0x00000000 be the msgtype.... :?:

Code: Select all

typedef struct
{
    DWORD ID;
    BYTE MSGTYPE;
    BYTE LEN;
    BYTE DATA[8];
} TPCANMsg;
in both cases the long hex number seems to me to be the ID...but, in this case...where is the msgtype :?:

Thanks

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Problem in Drivers installation under Linux-Kernel 3.2.0

Post by PEAK-Support » Thu 21. Aug 2014, 10:10

fake is if you post this (what you have done)

Code: Select all

*n -type- ndev --base-- irq --btr- --read-- --write- --irqs-- -errors- status
0 pci can2 f7d00000 209 0x001c 00000000 00000000 00000000 00000000 0x0000
do not mix up the output which conmes directly from the driver with the struct used with the API. You as application developer will ALWAYS should use the API and so please study the samples which come with the API (receicetest.c transmittest.c etc.) There you will find your answers - but we told you this many times before...

The driver output is build like this - here part of the source code that you already have.
You see x --> any status message , m --> real CAN message , s --> standard frame (11Bit)

Code: Select all

//----------------------------------------------------------------------------
// helper for use in read..., makes a line of formatted output
int pcan_make_output(char *buffer, TPCANRdMsg *m)
{
  u32 rest  = 8;
  char *ptr = buffer;
  int i;
  char r_or_m, s_or_e;

  *buffer = 0;
  
  if (m->Msg.MSGTYPE & MSGTYPE_STATUS)
  {
    // any status frames are x-ed
    r_or_m = 'x';
    s_or_e = 'x';
  }
  else
  {
    r_or_m = (m->Msg.MSGTYPE & MSGTYPE_RTR)      ? 'r' : 'm';
    s_or_e = (m->Msg.MSGTYPE & MSGTYPE_EXTENDED) ? 'e' : 's';
  }
  
  // print RTR, 11 or 29, CAN-Id and datalength
  sprintf(ptr, "%c %c 0x%08x %1d  ", r_or_m, s_or_e, m->Msg.ID, m->Msg.LEN); 

  // search the end
  while (*ptr) 
    ptr++;

  // "Vorsicht ist die Mutter der Porzellankiste!"
  // or "Better safe than sorry"
  if (m->Msg.LEN > 8)
  {
    for (i = 0; i < 8; i++)
    {
      sprintf(ptr, "---- ");
      rest--;
      ptr += 3;
    }   
  }
  else // print data
  {
    u8 ucLen;
    
    // don't print any data if it is a RTR message
    if (m->Msg.MSGTYPE & MSGTYPE_RTR)
      ucLen = 0;
    else
      ucLen =  m->Msg.LEN;
      
    for (i = 0; i < ucLen; i++)
    {
      sprintf(ptr, "0x%02x ", m->Msg.DATA[i]);
      rest--;
      ptr += 5;
    }
  }

  // else print 5 blanks for each not typed data
  rest *= 5;
  for (i = 0; i < rest; i++)
    *ptr++ = ' ';

  // print timestamp
  sprintf(ptr, " %11u %03u\n", m->dwTime, m->wUsec);
  
  // search the end
  while (*ptr) 
    ptr++;
 
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply