PROFIBUS ASICs: The SPC3
When the SPC3 first comes up, it enters the baud rate search state. Once it has discovered the network baud rate, it enters the parameterization state. Since this chip embodies PROFIBUS DP, it requires that the parameterization step be completed successfully, then a similar step for configuration, then it can enter the data exchange state.
The attached CPU, say an 8051 since that is what I used for this project, does not need to do a lot of interaction with the SPC3 during these phases. After initializing the SPC3 registers, which includes the buffer sizes for data exchange, the 8051 waits for a parameterization interrupt. It then validates the parameterization. Then it waits for a configuration interrupt and validates that. The SPC3 then moves to the data exchange state, and the 8051 only needs to waits for a data exchange interrupt indicating new received data. It also periodically sends the slave's data to the SPC3.
With a PROFIBUS DP network operating at 12MHz and scanning a slave every few milliseconds, a slow 8051 attached to the SPC3, as in the project described here, can't hope to keep up in real time. Fortunately the SPC3 handles all of the real time network I/O, requiring only that the 8051 write outgoing data to the SPC3 at least often enough that the watchdog timer does not time out.
To keep the transfers between master and slave atomic, it is necessary to prevent the slow 8051 from reading a message buffer that is in the middle of being updated. To accomplish this, the SPC3 provides a rotating buffer scheme using 3 sets of buffers. The buffer that the 8051 reads is not the same buffer that is receiving the real-time data exchange messages from the master. Before reading, the 8051 tells the SPC3 to change buffers and gets the address of the buffer (just taken offline) to read. This buffer holds the most recent data received from the master.
Likewise, to prevent the 8051 from writing to a buffer that has been partly sent, a similar buffer scheme using 3 sets of buffers is provided for sending. After writing to an offline buffer, the 8051 tells the SPC3 to change buffers and put that buffer online. At the same time, the 8051 gets a pointer to a different offline buffer for the next write.
If network data is exchanged every few milliseconds between the master and slave, the SPC3 will typically be sending and receiving the same data over and over before being read or updated by the 8051. This seems inefficient and wasteful of bandwidth as compared to networks such as DeviceNet that send messages only upon change of state. However, this approach does have advantages such as (1) Redundancy, and (2) A slave and master both know quickly if they have lost connection, and can stop and go to a safe state. If the slave is controlling machinery, this is a good thing.
To clarify one point that may otherwise be confusing - In the PROFIBUS literature and SPC3 data sheets you will see the terms "input data" and "output data." The terms input and output are always from the master's perspective. For example, the 8051 writes "input data" to the SPC3. This is outgoing data from the SPC3, but from the master perspective it is input data.
Other ASICs
The SPC3 is one of the lowest cost ASICs, and is available from Siemens for about $14 in quantity of 100. It is optimized for basic slaves using DP-V0 and DP-V1. Some other ASICs are the Siemens SPC42, LSPM2, DPC31, ASPC2, and SIM11.