The deep-sea measurement and control system based on the SJA1000 CAN controller basically meets the requirements of low power consumption, small size, light weight, and easy expansion. It is widely used in marine oil and gas field operations, marine pollution monitoring and control, marine fishery production, etc., with broad prospects.

Authors: Liu Jingbiao, Ye Jun

1 Introduction

In order to develop marine resources, human beings must first understand the seabed environment. However, the seabed environment is very complex, and the requirements for seabed detection are very high. There are many parameters that need to be collected in the deep sea environment, including depth, temperature, salinity, pH value, dissolved oxygen and various chemical elements.

The deep-sea measurement and control system needs to receive commands from the deck control center when working, and at the same time, the collected data must be sent to the deck control center. The maximum communication distance between the two is greater than 5km. Therefore, the communication requirements between them are very high. Compared with the general communication bus, CAN bus has outstanding reliability, real-time and flexibility in data communication. The direct communication distance of CAN can be up to 10km (the rate is below 5kb/s). The message adopts the short frame structure, the transmission time is short, the probability of interference is low, and the data error rate is extremely low. To this end, the CAN bus is used as a communication method.

2. Basic composition of deep-sea measurement and control system

The deep-sea measurement and control module consists of two parts: measurement and control sub-module and communication sub-module. The main function of the measurement and control sub-module is to start the system according to the command of the deck control center and complete the operations of parameter extraction, conversion, data processing, storage and transmission. The function of the communication sub-module is to complete the communication between the deck and the underwater measurement and control system.

The measurement and control sub-module takes Cygnal’s C8051F020 single-chip microcomputer as the core, and expands the signal conditioning circuit and the interface with the CAN bus. The communication sub-module is the SJA1000 CAN controller of Philips Company.

2.1 Measurement and control sub-module

The microcontroller is a C8051F020 single-chip microcomputer of Cygnal Company. C8051F020 adopts CIP-51 type microcontroller core and pipeline instruction structure, 70% of the instruction execution time is 1 or 2 system clock cycles, and the peak speed reaches 25MI/s. analyze. The C8051F020 single-chip microcomputer integrates a 12-bit 8-channel A/D converter with programmable gain amplifier and a 8-bit 8-channel A/D converter, which can meet the acquisition of multiple environmental parameters in the deep sea; 2 channels of 12-bit voltage output D/A converter; 16-bit programmable timing/counter array PCA can be used to output PWM to control the operation of stepper motors; 64 general-purpose I/O ports that are resistant to 5V voltage can control the start and stop of switching devices.

The microcontroller system also includes some basic peripheral circuits of the microcontroller. The system also develops a serial Flash memory with a capacity of 64Mbyte to save the collected data to avoid data loss when CAN communication is not smooth.When using, as long as the microcontroller is connected to the corresponding sensors, relays, motors, etc., the collection of parameters and corresponding control in various environments can be completed.

2.2 Communication sub-module

SJA1000 is an independent CAN controller introduced by PHILIPS, which is mainly used for regional network control in moving targets and general industrial environments. It is the PCA82C200 CAN controller (BasicCAN) substitute, and adds a new operating mode – PeliCAN, this mode supports CAN2.0B protocol with many new features.

The basic features of SJA1000 are as follows:

・Pin compatible with PCA2C200 type CAN controller.
・There is an extended receive buffer (64 bytes, first-in-first-out FIFO).
・Support CAN2.0A and CAN2.0B protocols.
・Supports 11-digit and 29-digit identification codes.
・The communication bit rate can reach 1Mb/s.
・Can interface with different microprocessors.
・Programmable CAN output driver configuration.

The pinout of the SJA1000 is shown in Figure 1, and the functions of the main pins are described below.

Design of deep-sea measurement and control system based on C8051F020 single-chip microcomputer and CAN controller

AD7-AD0: address data multiplexing line.

ALE/AS: ALE input signal (Intel mode) or AS input signal (Motorola mode).

CS: Chip select signal, low level allows access to SJA1000.

RD/E: RD signal (Intel mode) or E enable signal (Motorola mode) from the microcontroller.

WR: WR signal (Intel mode) or RD/WR enable signal (Motorola mode) from the microcontroller.

CLKOUT: The SJA1000 generates the clock output signal for the microcontroller; the clock signal is generated by the built-in crystal oscillator through a programmable divider; the clock stop bit in the clock divide register can disable this pin.

VDD1 and VSS1: logic circuit 5V power supply and logic circuit ground.

XTAL: Crystal oscillator amplifier input, the external crystal oscillator signal is input from this pin.

XTAL2: Crystal oscillator amplifier output, when using external crystal oscillator signal, this output pin must be open.

VDD3 and VSS3: Output drive 5V power supply and output drive ground.

TX0 and TX1: CAN output drivers 0 and 1 output to the physical bus.

INT: interrupt output, used to trigger microcontroller interrupt; any bit of internal interrupt register is set, INT will output low level; INT is an open-loop output; this pin is low to activate the circuit from sleep state.

RST: Reset input, used to reset the CAN interface (active low).

VDD2 and VSS2: Input Comparator 5V Power Supply and Input Comparator Ground.

RX0 and RX1: Input comparators from the physical CAN bus to the SJA1000.

The interface between the SJA1000 and the microprocessor is very simple, and the microprocessor accesses the SJA1000 by accessing the external memory. Since the internal registers of SJA1000 are distributed in consecutive addresses, SJA1000 can be regarded as external RAM. When designing the interface circuit, the chip select address of SJA1000 should have no logical conflict with the chip select of other external memories.

3. System design

SJA1000 CAN controller is compatible with CAN2.0A and CAN2.0B specifications. CAN2.0B has two different frame formats: standard frame and extended frame, the former is an 11-bit identifier, and the latter is a 29-bit identifier. The identifier of the former is 2 bytes less than the identifier of the latter. The number of CAN nodes in the deep-sea measurement and control system is small, only the upper computer node and the underwater measurement and control center node, so even if the distance is relatively long, the impact on the transmission data speed and reliability is not great.

3.1 Hardware design of microcontroller and CAN controller

Fig. 2 is the hardware connection circuit principle of C8051F020 single-chip microcomputer and SJA1000 controller. SJA1000 occupies 0x8000-0x80FF of external RAM space. When the microcontroller accesses the above space, the chip select signal will select SJA1000.

Design of deep-sea measurement and control system based on C8051F020 single-chip microcomputer and CAN controller

C8051F020 has two external memory interfaces, high and low. Therefore, AD0-AD7 of SJA1000 are connected to the high port P7 port of C8051F020, and CS is connected to the external memory chip select signal whose base address is 0x8000. When C8051F020 accesses address 0x8000-0x80FF, CPU can perform corresponding read/write operation to SJA1000. RD, WR and ALE of SJA1000 are connected with corresponding pins of C8051F020 respectively, INT is connected with INT0 pin of C8051F020, so C8051F020 can access SJA1000 by interrupting. The reset signal RST of SJA1000 is active low. The AD0-AD7 ports of the C8051F020 are used for address/data input/output. It is configured as an open-drain method and pulled up to 5V with a 4.7kΩ pull-up resistor. Configure the external interrupt pin of C8051F020 to port P2.7 by setting the digital crossbar switch.

CAN can use a variety of physical media, such as twisted pair and optical fiber. The design uses twisted pair. The signal is transmitted by differential voltage. The two signal lines are CAN_H and CAN_L, and it is 2.5V in static state. At this time, the state represents logic “1”, also called “recessive”. CAN_H is higher than CAN_L, which means logic “0”, which is called “dominant”. At this time, CAN_H=3.5V, CAN_L=1.5V. The TJA1050 CAN bus transceiver is the interface between the CAN protocol controller and the physical bus. The two-terminal node on the CAN bus must add a 60Ω resistor and a 47nF capacitor to absorb the signal to avoid signal reflection. In order to enhance the anti-interference ability of CAN bus node, TX1 and RX1 of SJA1000 are connected with TJA1050 through 6N137 high-speed optocoupler. In this way, the electrical isolation between each CAN node on the bus is well realized. Among them, the two power supplies VCC and V_CAN of the optocoupler part of the circuit must be completely isolated, otherwise the use of optocoupler is meaningless. The complete isolation of the power supply can be achieved by using low-power power supply isolation modules and switching power supply modules with multiple 5V isolated outputs.

Design of deep-sea measurement and control system based on C8051F020 single-chip microcomputer and CAN controller

3.2 Software Design

The communication protocol adopts the form of “ID+command+data+check”, where ID is the identifier of the network device, and adopts ID.18-ID.20. Identifiers ID.21-ID.28 are fixed commands and do not participate in acceptance filtering. The data represents the specific content of the communication. The check is 1 byte, in the form of checksum. Since the CAN bus itself has a 15-bit CRC check, and the number of nodes in the system is small, the competition will not be fierce, and the communication reliability is relatively high.

The software design idea is that after the system is powered on, C8051F020 initializes itself and SJA1000 to determine the main frequency, baud rate and output characteristics, etc., and then receives the control commands from the upper computer on the deck, and at the same time transmits the acquired sampling parameters to the SJA1000. On the CAN bus or backed up to the Flash memory; the initial design of SJA1000 is the key point and also the difficulty. The content written in each register must be carefully and comprehensively considered, otherwise the system will not run normally. The ACR of the host computer SJA1000 adapter card can be set to xx20, and the AMR to FF00. The ACR of the underwater measurement and control center SJA1000 is xx40, and the AMR is FF00.

Following the above ideas, the author uses C51 to write application software, and the following is a partial program list.

Initialization part:

void CAN_Init(void)
{CANMODE=0x09;//Enter reset mode, one-way acceptance filter, initialize SJA1000
CANCDR=0x88; //Select PeilCAN mode
CANIER=0x1A; //Open receive interrupt, overload

Since the deep-sea measurement and control system has high requirements for real-time communication, once the control command from the deck is received, it must respond in time. Therefore, the interrupt mode is used to receive information from the CAN bus. That is, SJA1000 makes INT become low level after receiving the message without error, and the falling edge triggers the external interrupt 0 of C8051F020, so that it enters the interrupt service routine. Its process is shown in Figure 3.

If you want to send data to the CAN bus, you must write a group of data that conforms to the PeilCAN frame format into the sending buffer of SJA1000, and then call the sending sub-function. Here, the query method is used to realize the sending. The process is shown in Figure 4.

Design of deep-sea measurement and control system based on C8051F020 single-chip microcomputer and CAN controller

4 Conclusion

The deep-sea measurement and control system based on the SJA1000 CAN controller basically meets the requirements of low power consumption, small size, light weight, and easy expansion. It is widely used in marine oil and gas field operations, marine pollution monitoring and control, marine fishery production, etc., with broad prospects.

The Links:   M170EG01-VA 1MBI600U4B-120