1 (edited by AlxBilt 16-01-2024 05:28:30)

Topic: Numerical value to CAN D1:D0

Project is ADC analog (sine) wave pulse on Ch.8 into CAN hex data.

Problem #1.

Current test cannot get Map (linear interpolation from one range to another) to adapt (convert) numerical values automatically per the pulse changes (variable change in speed) into HEX to be broadcast (TX) on D1:D0 data. 
I can manually enter numerical value into Map for D1:D0.
**Clarification**  D0 is the only required byte.

Problem #2.

When input pulse stop, CAN data do not stop TX or return to zero. Example: Vehicle come to stop.
How to get CAN ID TX to return to zero or disappear after no value read on ADC Ch.8?

*Area of problem is in red labels of diagram.

Thank you.

Post's attachments

Attachment icon 1_14_2024_VSS_ADC_CH8_CUMMINS_ECU_TX_215_0_SUBTRACTION_45_working pulse_CANdata.cfd 6.25 kb, 80 downloads since 2024-01-15 

2

Re: Numerical value to CAN D1:D0

There are several errors here. Let's try to break the problem down into smaller tasks and solve them sequentially.
As I said before if you need to count pulses, then the ADC will most likely not help you with this.
For debugging purposes, you can make a pulse generator on one of the controller channels and read those pulses with another channel.
Please connect the contacts of channels 0 and 8 of the controller with an external conductor and run the controller with attached diagram.
If you see the green LED flash twice per second then we can move on.

Post's attachments

Attachment icon PWM_COUNTER.cfd 1.55 kb, 82 downloads since 2024-01-15 

3 (edited by AlxBilt 16-01-2024 22:47:21)

Re: Numerical value to CAN D1:D0

I should of titled DEC2HEX.
My focus is on ADC due to the fixed sine wave from the project vehicle. I have to use an external amplifier to boost the analog volts up for the Canny Controller to wake up.

The PWM Counter is up and ready. Red LED blinks every 2 seconds.
Green LED stays illuminated once a pulse (digital or analog)is introduced.
No pulse coming out of Ch.0.


I am ready for next step.

Thank you Konstantin.

4 (edited by AlxBilt 17-01-2024 00:41:36)

Re: Numerical value to CAN D1:D0

*Correction* I had 0 as 7

Green LED blinking without user input from Ch7 counter on Ch8 with nice square wave.

I am starting to see why a counter would be better. I have used a counter in Arduino IDE but not sure how to do it in Canny IDE.

5

Re: Numerical value to CAN D1:D0

My focus is on ADC due to the fixed sine wave from the project vehicle. I have to use an external amplifier to boost the analog volts up for the Canny Controller to wake up.

Please keep in mind - you can count sine or square pulses if only it cross 3VDC. Like on picture below.

Measuring frequency by CANNY with acceptable accuracy over a wide frequency range can be challenging, in common case.
Fortunately, this task has already been done before.
I have attached an example that you can adapt to your task:
- Different test frequencies are generated on channels 0..7.
- The CH8 is a freq meter.
- The results are sent to the CAN. Some LED indication added.
Hope this helps.

Post's attachments

Attachment icon c72duo_fmeter.cfd 13.75 kb, 86 downloads since 2024-01-17 

sine.jpg, 13.74 kb, 594 x 313
sine.jpg 13.74 kb, 50 downloads since 2024-01-17 

6 (edited by AlxBilt 17-01-2024 23:12:58)

Re: Numerical value to CAN D1:D0

Thank you.

I have to figure out what this controller can do. The Composite block allows further creativity....wow!!

This thing is really Amazing.

7 (edited by AlxBilt 21-01-2024 22:43:08)

Re: Numerical value to CAN D1:D0

Hello Konstantin,

I am very close to a resolution but still testing.
Do the controller send TX by static or dynamic mode?

The controller appears to broadcast in what I describe as a static mode. Meaning, the first value TX is the only value that will be broadcast indefinitely.

Can the controller send TX in a live dynamic mode where a user can view the values change in real time view CAN bus? I am using SavvyCAN via ESP32 Dev PCB with a custom CAN shield to watch the TX sent by Canny controller on ESP32 RX.

I am trying to understand the Frequency Meter that is made by Composite block------ but,

Problem #1.
I can see a change from D0 of 0x00 going to D0 0xxx once the pulse input is added to Ch.8.
I cannot see a real time value of TX increase or decrease after the initial pulse input is introduced in regards to changes in pulse counter or changes made to your Frequency Meter values (Max Pulse Width; Pulse width step, ns; Range; etc). I am using an external pulse generator (Dakota Digital STA-1000)  rated at 60 mph which I can adjust the counter to have one fixed variable in this equation.   

Although, after some unrealized time has passed (in Frame Captured |Frames Per Seconds via SavvyCAN)  I notice the value of D0 changed on its own. This occurs randomly and I have not figured out how that is happening. Possibly due to a sleep / wake episode of Canny.

Do you know how the TX is periodically being changed?
Is the Frequency Meter counting indefinitely or is it resetting the count as an ABS module would during a drive cycle? It would be "interrupt" in C / C++.

Problem #2.
As I understand it, Composite block is a way to construct custom functions. I would like to construct a Composite block that is compatible to the code enclosed in the (Decoration) text notes.

For me to implement the Frequency Meter I must understand what each piece in the configuration is doing. I am trying to relate the frequency diagram to the code I have already tested with STA-1000 in Arduino with an ESP32 Dev pcb. Problem with ESP32 is that it is extremely sensitive to noise during testing but I did get an adjustable 60 mph reading via the Arduino monitor.

Do you have any build notes about the Frequency Meter for me to study?
Is it possible to construct my own Frequency Meter from my code provided in the notes?

Problem#3.
Once the input of Ch.8 is removed, the controller is still sending CAN frames viewed on SavvyCAN. A check of the CAN TX|RX via multimeter volts; oscilloscope reveals an active / dominate state TX. Concluding Canny controller will continuously TX once the initial input is implemented and continue TX after removal of the input signal from the circuit.

Thanks,

Post's attachments

Attachment icon 1_19_2024_VSS_ADC_CH8_CUMMINS_ECU_TX_215_0_28.cfd 15.6 kb, 85 downloads since 2024-01-20 

8 (edited by AlxBilt 21-01-2024 05:45:45)

Re: Numerical value to CAN D1:D0

Just wondering--

Is it possible to load C, C++ on a Canny Controller by user custom firmware?

9 (edited by AlxBilt 22-01-2024 01:16:54)

Re: Numerical value to CAN D1:D0

Today I realize a better way to ask my question looking at my STM32F407 settings.

Is there a way to set the Frequency Meter's - Counter Settings - in the form of;

-Prescaler : The amount to count 1 at each trigger number of 120. 120 being the tone ring tooth count of 120 per revolution cycle.

-Counter Mode: Counting up (rising) and down (falling).

-Time: How fast to count.

-Counter Period: Max number (120) to count up to 65535.


Or is it possible to build an Array?
Something of a counter with a Map / Array / a collection of variables that are accessed with an index number (the current count at a given time).

I added a Map block to the diagram which the results-- consistently are either 7F or 79 at the input of a consistent pulse.
Seems a bit more control or at the very least the results are predictable by adding the map.
Next issue would be a live reading (dynamic) instead of a static reading.

Post's attachments

Attachment icon 1_21_2024_VSS_ADC_CH8_CUMMINS_ECU_TX_215_0_11_working_map.cfd 13.36 kb, 75 downloads since 2024-01-22 

10 (edited by AlxBilt 22-01-2024 04:25:14)

Re: Numerical value to CAN D1:D0

Usable Diagram.
Digital pulse tested 569.5Hz at 2ms at 20v scale or 50v scale at 335.1Hz at 2ms.

Consistent results only when input trigger (pulse) is already attached. 


What is 1067 under Pulse width step, ns of the Frequency Meter; nano-seconds?

Post's attachments

Attachment icon 1_21_2024_VSS_ADC_CH8_CUMMINS_ECU_TX_215_0_19__58mph_working.cfd 13.29 kb, 80 downloads since 2024-01-22 

11

Re: Numerical value to CAN D1:D0

"Consistent results only when input trigger (pulse) is already attached.  "


Will work with a Delayed ON (DLN).

Post's attachments

Attachment icon 1_21_2024_VSS_ADC_CH8_CUMMINS_ECU_TX_215_0_22_delayedOn.cfd 13.43 kb, 82 downloads since 2024-01-22 

12

Re: Numerical value to CAN D1:D0

AlxBilt wrote:

Will work with a Delayed ON (DLN).

But this diagram will only send the CAN message once and not periodically.

What is 1067 under Pulse width step, ns of the Frequency Meter; nano-seconds?

Exactly. Please see note above Figure No. 10 here: https://cannylogic.com/docs/c72duo/io/# … ulse_width

Is there a way to set the Frequency Meter's - Counter Settings - in the form of

Not for the implementation contained in this composite block.

Or is it possible to build an Array?

This might work: https://cannylogic.com/docs/tips_tricks … cascading/

Is it possible to load C, C++ on a Canny Controller by user custom firmware?

The CFD-diagrams is only way to program CANNY for now.

The controller appears to broadcast in what I describe as a static mode. Meaning, the first value TX is the only value that will be broadcast indefinitely.

I think your CAN receiver (SavvyCAN via ESP32?) not in "Normal" but in "Listen only" mode. Please see: https://electronics.stackexchange.com/q … e-validity

Please switch your CAN receiver mode to "Normal" mode or set "1" in the "CANx Transmitting Cancel On Error Register"

And please check the bus termination: https://forum.cannylogic.com/viewtopic.php?pid=908#p908

13 (edited by AlxBilt 23-01-2024 07:26:47)

Re: Numerical value to CAN D1:D0

"But this diagram will only send the CAN message once and not periodically."


Oh............  I get it. Thank you.. I am a slow learner.
I went back to review the Docs.
I made adjustments.
Now I have two frames. I need to increase the quantity of TX frames and rate of change.
Update
*Transmitting Cancel on Error*cause a slow down. Soon as I changed to zero. The frames appeared in mass quantity but messages are not in real time. Meaning, the same values appear over and over regardless of change.
I am studying the TX Doc about periodically sending  but that looks like a static setup. I will see if I can manipulate two diagram (periodically TX and my original TX) for  better results.

14

Re: Numerical value to CAN D1:D0

Update.

I spent the evening reading up on pulse width as well as adjusting the diagram. I now have it where the live screen change is instant.

I am getting there.
My other issue may be the ACK from the slave node (ECU). There are only 2 modules in the vehicle. The engine ECU and Canny controller.

Victory is so close..

15 (edited by AlxBilt 24-01-2024 18:38:03)

Re: Numerical value to CAN D1:D0

Hello Konstantin,

Today I was able to perform several test.  Here is my findings and a question.

By changing Period and Duty of TX I was able to increase the TX traffic at a rate of 75 messages per second. I then tried a test with the live vehicle OBD2 PID reading but nothing.

I thought perhaps the TX rate was beyond what I saw the factory ABS module sending TX.  I reduced the TX rate to about 30 messages per second in accordance to what I observed on SavvyCAN.  Still no readings. I then had a thought to Use CAN Monitor 2.4 to inject the message via Run command instead of TX by diagram.

First I tried just the 0x215 ID and D1:D0 (0014), e.g 215 14 00. (I believe it should work with D0 but will try another day.)

Results: nothing in the OBD2 PID screen for speed.

Then I tried the complete 7 byte TX, identical to the ABS module.
215    14    00    81    59    81    59    07

**Note: bytes D3:D2; D5:D4 appears to be some type of counter. They run up at idle as if they are seconds and ms.
D7 is unknown.  D1 changes when the frequency generator button is pressed to increase the speed. Although the speed do not change until the second push of the button. A multi-meter check of the volts show slight increase at each press. **

Results were (25mph) satisfactory.
A repeat of 215    14    00    81    59    81    59    07 did not yield any results.
I had to cycle the key (12 power) once per TX message at the Run command line in CAN Monitor.

So it is now confirm that the controller forced message at Run command will cause a change.

My questions are:

1. What is the speed the "Run" command inject a TX message into the CAN bus?
2. Do you have a clue why a key cycle is required once per "Run" command TX message?


Also, as a note.
Once I adjusted the period and duty of TX,  "1" in the "CANx Transmitting Cancel On Error Register" was not required. I removed it completely and the TX data continue to change in real time.

I will retest sending one message in static form through a diagram to see the results.

Post's attachments

Attachment icon 1_23_2024_VSS_ADC_CH8_CUMMINS_ECU_TX_215_0_27_working_best settings_updateDuty4.cfd 17.16 kb, 83 downloads since 2024-01-24 

16 (edited by AlxBilt 24-01-2024 02:26:50)

Re: Numerical value to CAN D1:D0

What does value "8" represent at block "Equal TO (X==Y)" on the Sending Several Messages diagram (c72duo_can_7.cfd) example?

17 (edited by AlxBilt 24-01-2024 06:50:19)

Re: Numerical value to CAN D1:D0

Going down the rabbit hole from "Listen Only Mode in CAN and Message Validity."

Perhaps the reason why the engine computer did not acknowledge the speed message more than once is because I need to have the Canny controller set to also RX messages. Canny is not set to RX any messages in my diagram.


Have you ever heard of such an assumption? Is there a standard ACK message requirement to be placed in the diagram?

At the current level of my diagram build, I believe the controller is set to perform all requirements of TX transmission.

Edit*

The Kvaser websites states,

"an Acknowledgement Slot; any CAN controller that has been able to correctly receive the message sends an Acknowledgement bit at the end of each message. The transmitter checks for the presence of the Acknowledge bit and retransmits the message if no acknowledge was detected."

I assume that means that the receiving node will accept the data.

18 (edited by AlxBilt 25-01-2024 08:18:54)

Re: Numerical value to CAN D1:D0

Video Link
Today I did a test to trick the engine's computer to accept Canny controller TX data.

The idea is to place a static diagram on the controller that only sends constant messages.
215 14 00 81 59 81 59 07
I observed two sets of frame data from today's observation.
215 14 00 81 59 81 59 07 from "Input 1" and
215 DE AD BE EF 12 34 56  from "Input 0." (At first I did not know how this frame appeared.)

The results were just as I assumed. The engine computer sporadically accepted the TX data "215 14 00 81 59 81 59 07"
without having to key cycle (12v on/off cycle) the engine's computer power.

I made a video for you as well as photo screenshots.  The Google Drive link has been sent to your email so you can better understand.

According to SavvyCAN, the diagram attached is sending at least 350 frames per second.
I did not change the values at "Input 0." I changed values at "Input 1."
I notice that during the Sniffing connection to the vehicle that "Input 0" was also being RX by SavvyCAN. Something I did not expect because during previous bench test, "Input 0" did not appear so I just did not bother deleting the value in "Input 0."
Hours later doing another bench test reveal that "Input 1" is the only RX viewable.

I conclude "Input 0" will only appear when connected to a live vehicle.
We learned that with this diagram, the speed will show up in OBD2 PIDs but only sporadically.

Do you have any idea what is causing the sporadic acceptance of the data? (Basically the same issue as the previous questions.)

Post's attachments

Attachment icon 1_24_2024_Constant message.cfd 2.24 kb, 79 downloads since 2024-01-25 

19

Re: Numerical value to CAN D1:D0

Perhaps the reason why the engine computer did not acknowledge the speed message more than once is because I need to have the Canny controller set to also RX messages. Canny is not set to RX any messages in my diagram.

If the interface is initialized in Normal mode and filters are not enabled, then the controller accepts all messages. So the controller with your diagram will receive and ACK all correct messages on this baudrate.

Do you have any idea what is causing the sporadic acceptance of the data? (Basically the same issue as the previous questions.)

I received your links by email, thank you.
I'll take a look.

20

Re: Numerical value to CAN D1:D0

Video Link

The fact that the machine does not accept CAN data injections well is not surprising, since they can conflict with the original data, break the sequence, or overlap the original data.

If you are not injecting but replacing a device but sending data that does not accurately reproduce the original device's CAN traffic, then you should not expect excellent results either.

But if you completely disconnect the source of the original CAN data and replace it with a controller that will reproduce the CAN traffic of the original CAN data source as accurately as possible with all static and dynamic and service data and strict period, then the result may be different.

21

Re: Numerical value to CAN D1:D0

Konstantin, CANNY logic wrote:

Video Link


... strict period, then the result may be different.


Perhaps that may be the issue. The exact timing of the data being in correct sequence...

22

Re: Numerical value to CAN D1:D0

Perhaps that may be the issue. The exact timing of the data being in correct sequence...

Could it be that the exchange is two-way and the controller must respond to requests from the car in a timely manner, and not send messages at its own rhythm?

23 (edited by AlxBilt 26-01-2024 14:00:59)

Re: Numerical value to CAN D1:D0

Sounds plausible.

As mentioned above,

"any CAN controller that has been able to correctly receive the message sends an Acknowledgement bit at the end of each message."

I am just wondering how does the transmitting node RX the Acknowledgement bit. Is it CAN ID or just part of the data line--therefore the controller must be setup to receive RX data. 


An online friend of mine from YouTube AlexSV, who is very good with using a gateway pcb for CAN bus modification says, "Using a gateway negates this effect completely."  He recommends using a gateway as part of testing before final project use.

I took a break from diagrams for a few days.

24

Re: Numerical value to CAN D1:D0

I am just wondering how does the transmitting node RX the Acknowledgement bit. Is it CAN ID or just part of the data line--therefore the controller must be setup to receive RX data.

Please see here: https://stackoverflow.com/questions/318 … -ack-field


An online friend of mine from YouTube AlexSV, who is very good with using a gateway pcb for CAN bus modification says, "Using a gateway negates this effect completely."  He recommends using a gateway as part of testing before final project use.

If you have a CAN data source and a CAN data receiver and need to change CAN traffic between them, then a CAN gateway is a natural solution. But if you have an analog signal source and a CAN data receiver , then I'm not sure where to place the CAN gateway.

25

Re: Numerical value to CAN D1:D0

Hello Konstantin,

Check your email for my latest test videos and documentation on my findings. The 2nd video on 1/27/2024 shows Canny controller accepting the analog signal with pleasing acceptance of analog results as well as producing a response via TX data for the CAN bus. I believe the results are very promising.

I believe my parameters at the Frequency Meter > MAP as well as the PWM Generator > Rising / Falling edge (RED) for TX data speed and frame quantity into the CAN bus is in need of calibration.

I say, CANNY [c]an do it.