circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 99, October 1998
Networking with DeviceNet—Part 2: A Weather Station Application


by Jim Brady

Start Can Chips Chip Setup Real Time Message Flow Connections Timers Analog Input Point Identity Object Fragmented Messages Getting Physical Applying DeviceNET Software,Sources

FRAGMENTED MESSAGES

The weather station’s I/O Poll response is just three bytes—one byte each for device status, temperature, and humidity.

If I used floating point or added more sensors, the CAN message limit of 8 bytes would quickly be exceeded. I’d need to send the data in two or more fragments.

I/O message fragments are like normal messages except the first byte provides a fragment flag and a fragment count. That leaves seven bytes for data.

For maximum speed, I/O message fragments are sent back-to-back with no acknowledge (ack) message from the master other than the CAN level acknowledge bit.

Fragmenting an Explicit message is more complex. You send a fragment, wait for an ack message, and send the next fragment. If the ack takes too long, resend the fragment. If you time out again, give up trying to send the message.

Many error cases can arise, like getting an ack from the master with a fragment number different from what you sent, getting a message that’s not an ack while you’re sending fragments, and so on.

The weather station is capable of sending and receiving fragmented Explicit messages. Its serial number and product name are long enough to require it.

Fragmented messages are a big part of DeviceNet conformance testing. My program managed to pass a self-inflicted test using the ODVA conformance software. This software generates every conceivable bogus response and breaks all but the best code. You like challenges, right?