| In current intelligent transportation systems,most traffic signal controllers use RS485 bus to transmit vehicle detection data;compared with more advanced fieldbus,this method has certain restriction in various aspects such as communicative distance,communicative speed,reliability and so on.In order to improve the transmission efficiency of vehicle detection data,this paper proposes a new vehicle-based data transmission system which based on SPI-CAN,and makes software and hardware design to realize real-time as well as accurate transmission of vehicle detection data.This topic studies the new fieldbus technology of SPI-CAN.It has the advantages of strong anti-interference ability and long transmission distance of CAN bus.It also has the advantages of fast communication speed and simple use of SPI bus;Then designed the system communication protocol.The hardware part adopts STM32 microcontroller,and designs two kinds of device hardware circuits: data concentrator and data collector.The data concentrator hardware circuit includes: serial communicative circuit,JTAG program download circuit,power voltage regulator circuit,SPI-CAN communicative circuit and communication status display circuit;data collector hardware circuit includes: serial communication circuit,JTAG program download circuit,power supply stability Voltage circuit,SPI-CAN communicative circuit,slave address configuration circuit and Ethernet communicative circuit.The key communicative line of the transmission system uses a CAN transmission line and is connected to the SPI interface through the CAN converter CTM1051.The data concentrator and data collector are connected to the signal and video vehicle through the UART interface and the Ethernet interface,respectively.The software part uses a multitasking system based on u C/OS_III.The core tasks of the data concentrator software include signal data receiving task,data sending task,data receiving task,data uploading signal task and sending monitoring task,respectively,by "serial receiving completion" semaphore,sending flag event,"data receiving queue""Not empty,"data upload signal" semaphore and "data transmission completed" flag event drive;the SPI-CAN data to be sent and received is transmitted using the data queue.The core tasks of the data collector include data receiving tasks,vehicle inspection data selection tasks,Ethernet communication tasks,and data transmission tasks,respectively,by the "receive SPI-CAN packet" flag event,the "car inspection data selection" flag event,and "Ethernet communication interrupt" flag event,data transmission event drive;SPI-CAN data to be sent and received,"inspection required vehicle inspection data parameter" and transmission of vehicle inspection data are all used in queue.The subject completes the wiring,plate making and software and hardware debugging.The test consequently shows that the system has realized the efficient transmission of vehicle detection data and practicality. |