PCANBasic.Write function is not working

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
seongteh89
Posts: 6
Joined: Thu 6. May 2021, 09:46

PCANBasic.Write function is not working

Post by seongteh89 » Sat 22. May 2021, 09:32

Hi Guy,

I had tested the PCANBasic sample in C# for reading message from my ECU device and was successfully receive the byte after initializing( refer attachement picture)

While when I tried to perform write message into my ECU device. I put 03 28 as Hex data for writing, and i had go in debug mode to check the write message it was convert into 03 40 which is no longer Hex data. After all, the message box still showing message successfully sent.

But the problem the writing function was not trigger ECU firmware at all, no response from the ECU also, I had put debugger on S32 Design studio whenever any message receive on writing, it was not hit also, meaning that no message was writing into the ECU.

I tested in PCANView, read and write also function well.(refer attachment screen shot)

Kindly advise anything goes wrong on my testing? Thanks in advanced!
Attachments
PCANViewSuccess.JPG
PCANViewSuccess.JPG (65.94 KiB) Viewed 4628 times
DebugModeWrite0340.JPG
DebugModeWrite0340.JPG (76.24 KiB) Viewed 4629 times
Write0328.JPG
Write0328.JPG (53.59 KiB) Viewed 4629 times
PCANBasicReadNoProblem.JPG
PCANBasicReadNoProblem.JPG (111.21 KiB) Viewed 4629 times

seongteh89
Posts: 6
Joined: Thu 6. May 2021, 09:46

Re: PCANBasic.Write function is not working

Post by seongteh89 » Mon 24. May 2021, 09:28

Anyone please help, pleaseeee

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: PCANBasic.Write function is not working

Post by M.Heidemann » Tue 25. May 2021, 08:41

Hello,

Can you reproduce this issue with the unmodified application example as well?

Please report back to us regarding this.

Best Regards


Marvin
---
Marvin Heidemann
PEAK-Support Team

seongteh89
Posts: 6
Joined: Thu 6. May 2021, 09:46

Re: PCANBasic.Write function is not working

Post by seongteh89 » Wed 26. May 2021, 11:56

Hello Marvin,

I did not make any changes on the sample code, i just initialize it and perform write function. The screen shot i show is for debug and retrieve the value to checking purpose only

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: PCANBasic.Write function is not working

Post by M.Heidemann » Wed 26. May 2021, 12:09

Hello,

Then there is a different issue,
our code works 100% as intended.


Please check the following:

- Do you use the exat same bitrate settings as in PCAN-View?
- Is your bus properly terminated?

Also, your screenshot does not show you setting any CAN-ID, have you
set the CAN-ID appropiately in your application?

Hint: you can connect PCAN-View to the same hardware as you application and compare your trace with what you wnated to send from your application.

Please report back to us.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

K.Wagner
Software Development
Software Development
Posts: 1080
Joined: Wed 22. Sep 2010, 13:36

Re: PCANBasic.Write function is not working

Post by K.Wagner » Wed 26. May 2021, 12:58

Dear,

it seems to me like you are kind of confused. Please try to understand first what you are doing, before saying that software like PCAN-View and PCAN-Basic (used in several countries around the world for more than 20 years!) do not work. Not understanding something and just say that our software is not working well is kind of unfair.
seongteh89 wrote:
Sat 22. May 2021, 09:32
I put 03 28 as Hex data for writing, and i had go in debug mode to check the write message it was convert into 03 40 which is no longer Hex data
Note that it is just a "format representation". The value remains the same, since 28hex is 40 decimal. You has configured PCAN-View to show ID as decimal and Data as hexadecimal, which can be a little confusing. It is easier to understand if all components use the same format (ID and Data). Also note that programming environments also can be configured to show data in hexadecimal or decimal. Look for this in the options fo your programming tool. It is obviosly showing data in decimal format.
seongteh89 wrote:
Mon 24. May 2021, 09:28
But the problem the writing function was not trigger ECU firmware at all, no response from the ECU
  1. In your picture I can see that the PCAN-Basic sample does receive 12 messages .
    12 messages were reived
    12 messages were reived
    Counter.PNG (73.99 KiB) Viewed 4551 times
    So, from where are those comming, if your ECU is not responding?
  2. As far as I understand, your ECU needs a message of the form [ID:7FFh LEN:8 DATA:03h 28h 00h 00h 00h 00h 00h 00h]. But in your picture I see that you are sending a message with ID 0, so it is completly normal that your ECU does not respond.
    Sending messge with 0 as ID
    Sending messge with 0 as ID
    ID_NULL.PNG (189.22 KiB) Viewed 4551 times
seongteh89 wrote:
Mon 24. May 2021, 09:28
also I had put debugger on S32 Design studio whenever any message receive on writing, it was not hit also, meaning that no message was writing into the ECU.
Your ECU is not responding, because no valid data was received. It is then plenty normal that the breakpoint is not triggered.
Best regards,
Keneth

seongteh89
Posts: 6
Joined: Thu 6. May 2021, 09:46

Re: PCANBasic.Write function is not working

Post by seongteh89 » Thu 27. May 2021, 03:45

Dear Wagner/Heideman,
Also, your screenshot does not show you setting any CAN-ID, have you
set the CAN-ID appropiately in your application?
Your ECU is not responding, because no valid data was received. It is then plenty normal that the breakpoint is not triggered.
Sorry that my screen shot was confusing which I was forget to key in ID for screen shot, previously I had tried input 7FF which is Dec '2047' for the ID, what I mean was the PCANBasic.Write function did not send out the write message into ECU device, it not able trigger breakpoint in S32DesignStudio that will hit whenever receive any CAN msg.
Do you use the exat same bitrate settings as in PCAN-View?
Yes, both i using [/quote]
Yes, both PCAN-View and PCANBasic, i had input 500bit rate.
In your picture I can see that the PCAN-Basic sample does receive 12 messages .
The PCANBAsic sample was able to initialized and received message, this 12 messages i receive was after i initialized first time and received the original msg from ECU device, while when i trying to write new CAN msg into it, it seem does not send any CAN msg over.
Not understanding something and just say that our software is not working well is kind of unfair.
Sorry for my bad that making you felt that i am saying software not working well, i just describing the issues i facing due to in the PCANBasic screen showing the data message is in 'Hex' format(refer screen shot), so i tot the message will be send as what i key in which is 3 28, but when i goes into debug mode and check the data msg, it convert into 3 40. i thought it should be remain as 3 28? while i had try change the code "CANMsg.DATA = Convert.ToByte(txtbCurrentTextBox.Text, 16);" into "CANMsg.DATA = Convert.ToByte(txtbCurrentTextBox.Text, 10);" then the CAN msg was remain 28 instead of convert in become 3 40. Thanks
Attachments
DataHex.JPG
DataHex.JPG (18.54 KiB) Viewed 4540 times

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: PCANBasic.Write function is not working

Post by M.Heidemann » Thu 27. May 2021, 07:20

Hello,

It is not necessary to change the code of our supplied PCANBasic sample at all,
it's a working application out of the Box. As Mr. Wagner mentioned, the debugger will just represent the
data in a different format, that does not mean that PCANBasic is sending decimal values to the bus.

Please try the following:

- Use the original sample application
- After initialization of the sample application, connect PCANView to the same Hardware. You
will receive a info, that the baudrate cannot be changed, you can however still connect to the hardware.
- Make sure PCAN-Views Tracer is configured to log events and error frames:
PCAN-View_Trace_errors.png
PCAN-View_Trace_errors.png (9.06 KiB) Viewed 4538 times
- Start a Trace
- Send the message from the PCANBasic example application and check the Trace.
- Check the Status-bar (lower bottom) of PCAN-View
- Share the Status of the Status-bar and the Trace with us.

Please report back to us regarding this.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

Post Reply