Intrepid Tools at the Junction Tokyo Hackathon
Vehicle Spy &
neoVI Fire Basic
Download and Sample Projects
1. Sample Visual Studio CCode Interface Project – Adding CC3100
2. Sample Visual Studio CCode
Interface Project – TCP Client sending
CAN data to TCP Server using CC3100
What we are Offering to You
Intrepid Control Systems is a global provider of innovative tools for engineers in the vehicle networking, testing, and embedded engineering fields.
At Junction Tokyo, we are providing the following set of tools that will allow you to build applications that can communicate with electronic units inside your car over CAN network. We also offer the ability for you to take your application wireless by interfacing to Texas Instrument’s CC3100 Boosterpack from your application.
- Vehicle Spy Pro Software with CCodeInterface Visual Studio Development Environment
- neoVI FIRE (CAN / LIN Vehicle Network Adapter)
- neoECU CAN Bus Simulator
- CC3100 SimpleLink + Emulation Boosterpack Bundle
Some possible project ideas using the provided tools are:
- Design and implement your own Cybersecurity for CAN bus to protect your vehicle from getting hacked
- Hack your vehicle by remotely injecting arbitrary CAN messages into your vehicle’s CAN bus
- A smartphone app that captures / displays real time drive data via WiFi Direct connection (P2P) with CC3100
- A smartphone app that sends email or text message when you are driving above speed limit
Vehicle Spy Pro with CCodeInterface
Build your Automotive IoT Application Today!
Vehicle Spy Pro is a Vehicle Network tool from Intrepid Control Systems that enables you to monitor vehicle network bus, perform diagnostics, node/ECU simulation, data acquisition, automated testing, memory edit/calibration, and more.
Vehicle Spy Pro provides a way to write C code in Visual Studio that interacts with the automotive communication protocols Vehicle Spy works with such as CAN and LIN. The main advantage of using C Code Interface is that your code can access all the features of Vehicle Spy. Some examples of features you can access are vehicle network message decoding, message reception, database decoding, and display of signals. When you create a C Code Interface project, Vehicle Spy automatically generates a Visual Studio project that contains all the necessary source and include files for you to access such features.
Intrepid Control Systems provides ways for hackers to take their C Code Interface project wireless with popular IoT solution from Texas Instruments, the SimpleLink™ WiFi® CC3100 Boosterpack + Advanced Emulation Boosterpack bundle. The bundle allows developers to write code to emulate CC3100 MCU from PC via TI’s SimpleLink™ Studio library. Intrepid has made slight adjustments to the SimpleLink™ Studio library so that it builds seamlessly in the existing C Code Interface project environment (Visual Studio).
C Code Interface with SimpleLink™ Studio opens possibilities for developers to bridge WiFi® and automotive networks. This means you could write an application to receive some data from your vehicle network such as rpm and speed which then can be sent to a smartphone app wirelessly over WiFi Direct connection, local network, or internet. Some possible project ideas are:
neoVI FIRE Adaptor
neoVI FIRE is a multi-channel vehicle network adaptor that provides up to 6 channels of CAN and 4 channels of LIN. neoVI FIRE is fully compatible with our Vehicle Spy software. Users can use Vehicle Spy Pro to monitor and transmit on all networks simultaneously.
CC3100 SimpleLink + Emulation Boosterpack
This CC3100 boosterpack bundle from Texas Instrument consists of:
- CC31XXEMUBOOST-Advanced Emulation BoosterPack for SimpleLink Wi-Fi CC3100 BoosterPack plug-in module
- CC3100BOOST-SimpleLink Wi-Fi CC3100 wireless network processor BoosterPack plug-in module
The C Code Interface feature in Vehicle Spy Pro provides a way to write C code in Visual Studio to create your custom application that interacts with Vehicle Spy. Using the bundle, you will be able to extend your C Code Interface project to interface with the CC3100 wireless network processor. This allows you to write an application that leverages all the features of both Vehicle Spy and CC3100. The result is an automotive IoT application that connects your vehicle to the internet.
For more info about the CC3100 bundle, please visit https://store.ti.com/cc3100boost-cc31xxemuboost.aspx.
Install Vehicle Spy Software
- Click here to install Vehicle Spy software
- Then run the vspy3_install.exe file you downloaded.
- Click on Vehicle Spy 3 and follow the on-screen instructions. This will take a few minutes, since there are several drivers installed with the software.
- With the install done, click on Exit for the first screen.
- Double click on the red Vehicle Spy 3 Icon to start Vehicle Spy.
Vehicle Spy License
The password on the zip file is… vspy3r701-SWDV
Quick Guide to Integrating SimpleLink™ Studio into C Code Interface
Create a C Code Interface project in Vehicle Spy
To add a new project, click on the “Add Project…” button (Figure 1), and a drop down will appear giving the options to add a new project, convert from CAPL, or add an existing project.
Figure 1: Adding a new C Code project in the C Code Interface view.
If a new project is selected, a windows will pop up called “Add New C Code Project”. Here a project name and a description is entered in. Vehicle Spy will then create a new base project and launch Visual Studio. Next the “Edit” button can be used to create events or the project can be worked with in Visual Studio. Make sure you build the DLL once before starting Vehicle Spy, otherwise, you will not have anything for Vehicle Spy to load – this will result in an error.
Figure 2: You need a project name and description to create a new project.
Add SimpleLink™ Studio to the generated C Code Interface project
First, download the SimpleLink Studio archive from https://github.com/jchung-intrepid/CCIF_SIMPLELINK_BASE.git. Copy the entire ‘simplelink’ folder and paste it into the project directory. You can open the project directory from Visual Studio by right clicking on the project and selecting ‘Open Folder in File Explorer’.
In Visual Studio, right click on the project and use Add -> New Filter to add a ‘simplelink’ directory with three sub directories named ‘include’, ‘common’, and ‘source’. Then, drag and drop all contents of each directory from your project directory.
In Visual Studio, make the following changes to the project properties:
- Go to Configuration Properties -> C/C++ -> Additional Include Directories. Add
$(SolutionDir)\simplelink\, $(SolutionDir)\simplelink\include, $(SolutionDir)\simplelink\source, and $(SolutionDir)\simplelink\common.Figure 4: Add simplink include paths to the project.
- Goto Configuration Properties -> Linker -> Input -> Additional Dependencies. Add
Add $(SolutionDir)\simplelink\SimpleLinkStudio.lib.Figure 5: Add simplink library path to the project.
- Goto Configuration Properties -> C/C++ -> Code Generation -> Runtime Library. Set to ‘Multi-threaded DLL (/MD)’.Figure 6: Set Runtime Library to link dynamically during build.
- Goto Configuration Properties -> C/C++ -> Precompiled Headers. Set to ‘Not using precompiled header’.Figure 7: Change Precompiled Header to ‘Not Using Precompiled Headers’.
- Include “simplelink.h” in SpyCCode.c. Then, copy and paste the following function stubs in SpyCCode.c. These are asynchronous callback functions used by SimpleLinkStudio™ to notify various network events and need to be defined somewhere in your program.
\brief This function handles WLAN events
\param[in] pWlanEvent is the event passed to the handler
void __cdecl SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent)
\brief This function handles events for IP address acquisition via DHCP
\param[in] pNetAppEvent is the event passed to the handler
void __cdecl SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent)
\brief This function handles callback for the HTTP server events
\param[in] pHttpEvent – Contains the relevant event information
\param[in] pHttpResponse – Should be filled by the user with the
relevant response information
void __cdecl SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent,
\brief This function handles general error events indication
\param[in] pDevEvent is the event passed to the handler
void __cdecl SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent)
\brief This function handles socket events indication
\param[in] pSock is the event passed to the handler
void __cdecl SimpleLinkSockEventHandler(SlSockEvent_t *pSock)
Build the C Code Interface project
If you have completed step 2, your C Code Interface project should compile successfully. You are now ready to add your code in SpyCCode.c or add additional source and header files as needed to build your desired application.
Run the built C Code Interface DLL with Vehicle Spy
When you build your C Code Interface project in Visual Studio, the result is a DLL that plugs into Vehicle Spy. The DLL exports a set of standard functions, which Vehicle Spy calls to make everything work. When you start Vehicle Spy, it will dynamically load the DLL and execute your C Code Interface project.
To do this, go back to Vehicle Spy where you created your C Code Interface Project. Click on the play button located on the top left corner of the window and Vehicle Spy will start. If you have already completed our hardware setup guide, Vehicle Spy will connect to neoVI FIRE and gain access to the vehicle network that neoVI FIRE is connected to. After Vehicle Spy starts, you will notice that the Output console will start printing ‘Another Second happened’ as defined in the Spy_Main().
SimpleLink™ Studio Archive – Contains changes from Intrepid Control System to build seamlessly in C Code Interface project environment.
Base VS Project for C Code Interface + SimpleLink Studio – This is a clean archive of Visual Studio project containing all the default C Code Interface and SimpleLink™ Studio source and library files. Use this as a base to quickly start developing your application for Vehicle Spy and CC3100. Start coding your application by extending SpyCCode.c.
Sample Project: TCP Client that sends CAN Messages to TCP Server
This sample application demonstrates how programmers can use Event Handlers in C Code Interface to receive various data from Vehicle Spy such as CAN messages and application signals. This DLL application will open a TCP socket connection to a remote TCP server and send the CAN data from Vehicle Spy to the server.
To learn more about Event Handlers, checkout the ‘Message Objects’, Application Signals’, and ‘Timers’ help doc in Vehicle Spy.
Files and Equipments Needed
- neoVI FIRE – CAN network interface. Connects to vehicle network bus via 25pin connector. Connects to Vehicle Spy PC software via USB.
- neoECU Simulator – Vehicle CAN network simulator. Each of the Knobs 1 ~ 4 are mapped to unique CAN message.
- SimpleLink™ WiFi® CC3100 Boosterpack + Advanced Emulation Boosterpack bundle.
- Vehicle Spy Pro
- Visual Studio 2015, 2013, 2010, or 2008.
- CCIF_SimpleLink_TCP.vs3 – A Vehicle Spy 3 save file that loads and executes the user code in CCIF DLL. It contains decoding information of four CAN messages, which are handled by the four Rx Message Event Handlers. When Vehicle Spy receives any one of those messages, it will forward them to CCIF by invoking the matching Event Handler callback.
- CCIF_SimpleLink_TCP Archive – This archive contains all the C Code Interface source files for this sample application.
This sample C Code Interface application does the following:
- Initializes the CC3100 board to a default state and connect to a WiFi AP of your choice. The application will retry every 1 second until connection is made.
- Attempts to open a TCP connection to a TCP server listening at port 5001. The application will retry every 1 second until connection is made.
- Data from the server will be received by the BsdTcpClientReceiveProcess function. For the sake of demonstration, the function will simply echo the received data back to the server.
- Anytime Vehicle Spy receives a CAN message that matches one of the four messages defined in the Receive Table of the Messages Editor, CCIF_SimpleLink_TCP.vs3 will invoke the matching Event Handler callback function defined in the C Code Interface DLL. When Vehicle Spy invokes the callback function, it will pass the pointer to the CAN Message object to the DLL. Figure 1: Messages Editor window showing the four CAN Receive Messages. Figure 2: C Code Interface ‘Edit’ window showing Event Handlers for the four Receive Messages
- The Event Handler callback receives the CAN Message from Vehicle Spy and sends the 8 byte content of the message to the connected server via socket. Figure 3: Receive Message Event Handlers defined in the C Code Interface project.
Running the Sample Application
Before you proceed, please make sure that you have all the hardware, software, and download contents from the step 1.
- Open the C Code Interface DLL project in Visual Studio and set the WiFi AP connect credentials and TCP Server IP address.Figure 1: Define parameters needed to connect to an AP such as SSID and Passkey in sl_common.h.
- Double click the downloaded ‘CCIF_Simple_TCP.vs3’ file to start Vehicle Spy. Press the ‘Edit’ button from C Code Interface window and set the project path to the Visual Studio project file located in the downloaded CCIF_SimpleLink_TCP archive.Figure 2: CCodeInterface ‘Edit’ window – change project path to the directory in your PC where .vcxproj is located.
- CAN messages originate from physical CAN networks in your vehicle. Hence, we must first connect a CAN network adaptor to the vehicle’s CAN bus. Do this by taking the 25pin – OBDII cable and connecting your neoVI FIRE to the 25pin connector of the cable and the OBDII connector to your car’s OBDII port. For those who do not have access to an actual vehicle, Intrepid is providing a CAN bus simulator which generates fixed set of CAN messages to mimic a CAN bus. This simulator, called neoECU Simulator has an OBDII port which conveniently plugs into the OBDII connector on the 25pin – OBDII cable. Finally, supply power to the neoECU Simulator by connecting the provided power pack to the 12V barrel jack connector. This will power both neoECU Simulator and neoVI FIRE.Figure 3: neoVI FIRE and neoECU Simulator connected via 25pin – OBDII cable.
- Now that we have a CAN adaptor (neoVI FIRE) connected to your vehicle or the neoECU Simulator, we need to connect the neoVI FIRE to the PC so that it can forward all received CAN messages to the Vehicle Spy software. Do this by simply connecting the USB cable between neoVI FIRE and your PC.
- At this point all Intrepid hardware and software should have been configured. Finally, connect the CC3100 Boosterpack + Advanced Emulation boosterpack board to your PC using the provided micro USB cable. Figure 4: Connecting CC3100 from http://processors.wiki.ti.com/index.php/CC31xx_Quick_Start_Guide.
- Make sure CC3100 board is properly connected to your PC. Open Vehicle Spy. When you start Vehicle Spy, it should have full read & write access to the connected CAN bus via the neoVI FIRE adaptor. Start Vehicle Spy by pressing the play button on the top left corner of the window. You should see a real-time trace of all CAN messages generated by your vehicle or the neoECU Simulator from Vehicle Spy’s Messages view.Figure 5: Messages window showing real-time CAN traffic and CCodeInterface window showing output from DLL.
- Identify the four CAN messages that contain data that represents the first four knobs on the neoECU Simulator. Vehicle Spy will send those messages to the C Code Interface DLL, which will then forward them to a remote TCP server via connected socket.Figure 6: Messages window showing the four CAN Messages mapped to neoECU Simulator Knobs.
- Verify that Vehicle Spy has successfully loaded the C Code Interface DLL by observing the ‘Output’ tab of the C Code Interface window.Figure 7: CCodeInterface Output console showing CC3100 connection status.
- Setup a remote TCP Server on your Smartphone, MAC, or PC with proper IP address and port number. If you are using an Android phone, convenient way to do this is to download the TCP/UDP TEST TOOL app by animod from Google Play and use the app to setup a TCP Server.Figure 8: A sample TCP Server application used for testing.
- Click button from Graphical Panel to instruct C Code Interface DLL to start forwarding CAN data to the connected TCP Server. Data sent by the TCP Server can be viewed in Vehicle Spy by observing the ‘Output’ tab of the C Code Interface window.Figure 9: Click the ‘Send CAN Data to TCP Server’ button from Graphical Panel window to instruct CCodeInterface to send data to the connected TCP Server. There is also a Red/Green LED indicating the socket connection status.
Figure 10: Android app showing CAN data sent by CCodeInterface using socket connection made by CC3100.
CCIF_SimpleLink_TCP.vs3 – A Vehicle Spy 3 save file that loads and executes the user code in CCIF DLL. It contains decoding information of four CAN messages, which are handled by the four Rx Message Event Handlers. When Vehicle Spy receives any one of those messages, it will forward them to CCIF by invoking the matching Event Handler callback.
Base VS Project for C Code Interface + SimpleLink Studio – This is a complete archive that contains all the C Code Interface source files for this sample application. Use CCIF_SimpleLink_TCP.vs3 to load and execute this DLL project.