Home

Installing CDNC

Getting Started

FAQ

What's New

CAN-Do! NET Controller

A Ready to use AMSAT-CAN Multiple Module Controller

Software by

KC0FTQ

Controlling Widgets with CDNC

CAN-Do! NET Controller Website Copyright © 2007, by Stephen M Moraco, KC0FTQ
E-mail:
kc0ftq at AMSAT dot org

Microsoft, and Windows are either registered trademarks or trademarks of
Microsoft Corporation in the United States and/or other countries.

Visit our CAN-Do! Project website at http://can-do.moraco.info

Site updated: 4/24/2007 2:50 AM

This page provides a quick walk-thru of the main features of CDNC when used with a Peak Systems PCAN USB adapter or the Lawicel CAN232 Serial adapter to communicate with one or more Widgets on the CAN bus.

Interacting with one or more Widgets on the CAN bus

To start this tour you need to have your interface device (PCAN USB, or Lawicel 232) plugged into your PC, the CAN cable hooked up, the Widget plugged into cable and cable power applied.

Selecting our Interface hardware

· We must first tell CDNC which hardware we are using.  Do this by selecting
Edit->Preferences… to get our “CAN-Do Net Controller Preferences” dialog.

· Now select the “Net Options” tab from where we can setup our device.

· At the Net Options tab you see a “CAN Interface” panel wherein you will select either the PCAN USB device or the CAN232 device.  If you choose CAN232 then the Port and Baud Rate controls are enabled so you an set these values.

· Once you’ve selected the device you are using then press [OK] to apply your selection and close this dialog.

· If you’ve specified the device correctly you will see “Connected” in the bottom right status area and in the bottom left the device/driver specifics will be shown. Hovering over these will provide more information if part of the status appears off screen.  If there is a connection problem the bottom left area will contain more information to help diagnose the problem.

Now that we have communication with our controller established let’s talk to Widgets!

Locating the devices on our cable

· CDNC only allows interaction with widgets which are known to exist on the CAN bus.

· In order to determine the set of widgets present we press the ’Query’ button or  select
CAN->Query Devices from the menu.  NOTE: if either of these is unavailable CDNC failed to locate your controller.  You will need to get that connection working before going further.

· After a brief pause you should see one or more Widget icons appear in the Bus Overview tab. Each of these icons represents a single widget on your cable.  If you have less icons in your overview than you have Widgets on your cable then you have one or more widgets not responding to the query and this needs to be corrected before you will have access to controlling them.

In the offline mode tour we walked through the interaction with these widget icons so I will not replicate that here but lets now look at a couple key interactions.

Watching the traffic as it happens

· Now that Queries are working let’s watch one happen.  Press the “Show Packets” button to open our “Can-Do Packet Log”  You should see the packet log window appear to the right of this main window.  NOTE: If you move the main window the packet log will float with the main window staying in this position relative to the main window.

· When this window appears you should see packets already showing here.  Let’s do our query one more time.  Press the “Query” button and you should see a query packet being sent followed by a new packet being received (one for each widget on your cable.)

· Let’s look more closely at these latest packets. The outbound query is a 0x14 message (look under the heading “Msg” to find it.)  The inbound responses to queries should be 0x34 messages so you should see at least one of these.

· To the left of  this “Msg” heading you see the heading “Dvc”.  This is the device address contained in the message (AMSAT CAN Protocol).  So you should see the address of your Widget here in this column.  NOTE: by default CDNC starts up as device #3.  We allow for device 1 and 2 to be IHUs so we are staying out of their way by defaulting to #3 in case they are on the same cable.  If the widget device address is showing up as 63 then you have likely not programmed a device address using the solder pads on the Widget.

· Left of the Dvc heading you see ID.  This field is made up of both the Device ID and the Message ID.  It is this overall ID that is our real CAN message ID (CAN Bus standard). So if you are using a CAN analyzer of some form and are looking for packets you will need to look for this ID not the Dvc or Msg values.

· Left of the ID field is the Time field.  For fun, click on the heading of this Time column.  Each time you click on the heading it will show the times in the next form. Currently it toggles between relative time and absolute time.  Absolute is time-of-day while relative is the amount of time between the packet and the packet above it in this log.

· Finally, let’s look at the payload field.  This all the way to the right. For our AMSAT CAN traffic this will be 0, 2 or eight bytes long.  When it is eight, as in our query response you will see a slight gap (space) between the first four bytes and the last four.  This allows for easier byte counting.

All of these message IDs, payload-byte bit meanings etc. can be found in the Widget User’s guide. They are also called out in great detail in the firmware source code.

The waterfall log behaves similarly but you have seen it already in the previous tour.  So, let’s move on to interacting with our Widget.
[ Press the Widget [Show] button to continue the tour ]

   Widget: Control/Status Sub-tab

· You’ll see that a new tab has been created for your Widget and the interface has now changed to be five sub-tabs under the Widget tab.  The first tab [Control] is currently selected and we now see the control/status page for this Widget.  During the Offline Mode tour you saw what all these indicator were.  Not let’s look at the two control styles offered by CDNC.

· Our IHU is constructed to send whatever bits are in memory to the widget every 20 mSec.  This CDNC software is constructed the same way except that you have control over how often packets are sent.  This also means that unless you are sending configure packets (this heartbeat is turned on) you can change the controls in front of you all day long but the widget will never hear of the changes. This is to say that these buttons Power, digital OUTx bits, etc. are all simply adjusting these in-memory bits which will next be sent to the Widget on the next heartbeat.  So, let’s turn on a slow heart beat so we can see these changes.
Select ‘2 Sec (0.5 Hz)’ interval from the pull down and then press the ‘Heartbeat’ button to continue this tour.

   Widget: under heartbeat configures control

· Now that our 2Sec heartbeat is running, you should see all the analog readings updating every poll.  You should also see a number of packets being returned in response to the configure heartbeat.

· Now if you click on the Power button you should see it light and the next time a configure packet is sent the power will be turned on at the module.  Turn the power off again and wait and the next packet you see sent will have the power-bit turned off.

· So, in this mode changes you make are echoed out to the Widget at the next configure but you could easily have been in the middle of changing more than one when the packet was sent. The next bits you change will go in the next packet.  But maybe this is not what you want.  Maybe you want to set a group of bits and then have them all change in one packet!  This is what the UHU style of updates supported by CDNC is all about.  Let’s now explore that mode.
Select Edit->Preferences to continue this tour.

· In the CAN-Do Net Controller preferences dialog we now see the “general” tab. On this tab we see the “Widget User Interface Behavior” panel.  In this panel let’s select “Apply changes as group using [Set Outputs] button”.  Select this radio button and press [OK] to continue.

Widget: under heartbeat configure control using grouped changes

· In this new mode we have a couple of new effects to see.  First there is a new [Set Outputs] button now on our control panel which is currently disabled.  This is disabled because we have not made changes to any of the output bits yet.

· Press the power button now and you should see three effects:
1—the [Set Outputs] button is now enabled indicating the we have changes which are not yet applied
2—the label text on the Power button has turned red (indicating that it has changed settings since the last Set Outputs press.
3—the right-most byte of the Configure Payload display has also turned red (indicating that this value is different since the last configure payload was sent.)

· Notice now that if you click the power button again all of these changes go away.  That is to say that the settings as currently shown now reflect that which was last sent so there is nothing new to be applied.

· Of course the more normal means to make these changes go away is to actually apply the set of changes which you would do by pressing [Set Outputs].  This commits the changes to the in-memory set of bits which then will be sent out in the next configure packet.

Wrapping up our Online Tour

So there you have it. You’ve just seen how to configure CDNC for the controller you are using. You’ve seen how to establish communication with whatever widgets you have on your CAN cable and you’ve seen how to control the heartbeat communication with the widgets on the cable.  Lastly you learned that we support two different control settings change styles: bits as they are changed or bits when they are committed as a group of changes.

If you have suggestions for new capabilities or you see something happening that you don’t understand or think needs fixing please let me know at the email address found at the bottom of this page.

Likewise, if you liked this tour, let me know. If you see something you’d like added to this tour you can let me know that too.  ;-)

Please enjoy using CDNC.