<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://socialledge.com/sjsu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=146+user15</id>
		<title>Embedded Systems Learning Academy - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://socialledge.com/sjsu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=146+user15"/>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php/Special:Contributions/146_user15"/>
		<updated>2026-05-05T23:45:27Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44914</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44914"/>
				<updated>2018-05-19T22:46:57Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:IMG 3326.jpg|right]]&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Our project aims to provide a theft detection service by recording a video when any movement is detected in an immediate vicinity. A video feed is stored on the device to collect later on. The video feed can be used as evidence to provide authority to find the culprit. This report details the system and technology used to implement this project.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
Our primary goal for this project was to learn about the sleep modes that the LPC Microcontoller is capable of. In order to help us understand the functionality of the technology, we wanted to implement the sleep modes on a real life practical example. &lt;br /&gt;
 &lt;br /&gt;
Living in the Bay Area, a highly technological society, most tech employees travel with expensive equipment in their cars. Knowing this thieves consider this a prime area to conduct car robberies. Recently there has been an increase in these car robberies, where it can be hard to catch the criminals who have committed the theft. Often times the robbers work so quickly and discretely that a normal bystander might not consider the act suspicious. Additionally if your car is parked in remote area, far away from city cameras, it can be hard gather any evidence to catch the thief. Video surveillance evidence is highly valuable to an investigator assigned on the case. &lt;br /&gt;
&lt;br /&gt;
Our video surveillance device, records footage if a crime is committed in a customers' car. Sensors in our device activate a camera to start recording when movement is detected. In its idle state, the device is in sleep mode where minimal tasks are being run on the device, which means it saves on a lot of power consumption. Alternatively if the device is constantly polling, this would use up an enormous amount of battery power. Since this device is meant to be running in a car that is not running, it is pertinent to use minimal power unless absolutely necessary to maximize the battery life. &lt;br /&gt;
&lt;br /&gt;
This application can be scaled for any environment; your home, backyard, or even for city use. We can connect it every street lamp with some IOT capabilities resulting in lower crime rate across the city. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
* Research Power consumption capabilities of micro-controllers. &lt;br /&gt;
* Build and implement a video surveillance device to feature the low power methods. &lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;1337fLuFFy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis, System Design   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 03/04&lt;br /&gt;
|&lt;br /&gt;
* Research hardware and software, plan steps. &lt;br /&gt;
* Team Building and Ideas. &lt;br /&gt;
| &lt;br /&gt;
* Decided what the project will entail and the approach.&lt;br /&gt;
* Team member tasks are given.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 03/11&lt;br /&gt;
| &lt;br /&gt;
* Team Research.&lt;br /&gt;
| &lt;br /&gt;
* Individual Research on the subject. Meow Week.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 03/18&lt;br /&gt;
| &lt;br /&gt;
* Give specific tasks to team members.&lt;br /&gt;
* PCB Design.&lt;br /&gt;
* Finalize the project idea.&lt;br /&gt;
| &lt;br /&gt;
* Divided the project into different sections.&lt;br /&gt;
* Assigned roles and responsibilities to each member.&lt;br /&gt;
* Initial PCB design is done in Eagle.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 03/25&lt;br /&gt;
| &lt;br /&gt;
* To finalize PCB, and order components.&lt;br /&gt;
| &lt;br /&gt;
* Ordered Components, PCB was sent for printing.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 04/01&lt;br /&gt;
| &lt;br /&gt;
* Power mode research(different team members different areas).&lt;br /&gt;
* Solder PCB components and test.&lt;br /&gt;
* Modify the architecture and flow of project if necessary.&lt;br /&gt;
| &lt;br /&gt;
* Individual research on power modes initialized.&lt;br /&gt;
* Finished Soldering components on the PCB.&lt;br /&gt;
* Architecture and flow of project modified and implemented.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 04/08&lt;br /&gt;
|&lt;br /&gt;
* Test and Implement the PIR motion sensors and connections.&lt;br /&gt;
* Establish connections between the LPC and Beaglebone.&lt;br /&gt;
| &lt;br /&gt;
* PIR sensor test and implementation done.&lt;br /&gt;
* Interrupt and connections between the two microcontroller boards are done.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 04/15&lt;br /&gt;
|&lt;br /&gt;
* Test all the lower level components.&lt;br /&gt;
* implement the sleep mode and power down modes.&lt;br /&gt;
| &lt;br /&gt;
* Tested the lower level sensors and the power source (PCB and Lipo Battery).&lt;br /&gt;
* Tested and implemented one of the power down modes.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 04/22&lt;br /&gt;
| &lt;br /&gt;
* Prototype of the shell of the project.&lt;br /&gt;
* Write and further test implementation of low power modes.&lt;br /&gt;
|&lt;br /&gt;
* 3D rendering of the prototype done. yet to be printed.&lt;br /&gt;
* Further research and implementation of power modes done. More research needed.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| 04/29&lt;br /&gt;
| &lt;br /&gt;
* Integrate code with PIR and Low Power functionalities&lt;br /&gt;
* Rob Went to Napa Valley.&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* PIR Integration Complete&lt;br /&gt;
* Rob drank wine.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| 05/06&lt;br /&gt;
| &lt;br /&gt;
* Get the Camera and the overall system done.&lt;br /&gt;
* Bitcoin will hit 10000.&lt;br /&gt;
* Test the power consumption of each &lt;br /&gt;
|&lt;br /&gt;
* Testing Power modes complete&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| 05/13&lt;br /&gt;
| &lt;br /&gt;
* MEOW @ PREET&lt;br /&gt;
* Finalize Prototyping and print the housing&lt;br /&gt;
* Collect Images and Video for documentation&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics and the interface here.&lt;br /&gt;
&lt;br /&gt;
===== Low-Level Hardware =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The low-level design starts from the PIR Motion Sensors and ends with the storage of the video data. The LPC1758 plays a big role in the communication of the overall system. The PIR sensors are each connected to the LPC1758 using a GPIO protocol and send signals if an object or and person is within their range. Once the signal is sent from the Sensors, the LPC wakes up and consumes power from the PCB which either uses the power from a plugged source or the backup LIPO battery. LPC then sends the right information to the BeagleBone board using UART protocol.&lt;br /&gt;
[[File:Meow hardware schematic.JPG|bottom]]&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
ADD description and design of the software for both the boards&lt;br /&gt;
&lt;br /&gt;
=== Printed Circuit Board Design ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to stabilize and provide a noise free power supply to all the components of the system, a printed circuit board(PCB) was created. This piece of hardware brings all the power consumption of the unit together. The design and the creation of the board was done in Eagle Schematics Software where the gerber files were created. Once the gerber files were ready, the files were sent to be printed. There were 2 iteratins of this board. The first lacked the necessary connections for the additional components and had several noise reduction flaws. The second board solved all these issues. Note that the final board had to be 1 layer due to the noise reduction characteristics of the material and the ability for placement of the LIPO battery on the bottom of the board.&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
[[File:Meow Eagle schematic.JPG|bottom]]&lt;br /&gt;
&lt;br /&gt;
[[File:MEOW PCB schematic.JPG|bottom]]&lt;br /&gt;
&lt;br /&gt;
== NXP LPC1700 Series Power Modes ==&lt;br /&gt;
&lt;br /&gt;
=== Power management functionality in LPC 176x CPU ===&lt;br /&gt;
&lt;br /&gt;
* There are mainly 4 modes of runtime power savings mode that are available in LPC 176x CPU. They are described in details as follows&lt;br /&gt;
**Normal sleep&lt;br /&gt;
**Deep sleep&lt;br /&gt;
**Power Down mode&lt;br /&gt;
**Deep Power mode&lt;br /&gt;
* How to put to sleep&lt;br /&gt;
**WFE (wake from exception) or WFI (wake from interrupt)&lt;br /&gt;
* How to wake up system&lt;br /&gt;
**Wake up interrupt controller (WIC)&lt;br /&gt;
**General interrupts&lt;br /&gt;
&lt;br /&gt;
=== Entering ===&lt;br /&gt;
&lt;br /&gt;
Power mode entry is based on tables 44 (Power Mode Control register) and 662 (SCR bit assignments) of UM10360 [1].&lt;br /&gt;
&lt;br /&gt;
 void enter_sleep()&lt;br /&gt;
 {&lt;br /&gt;
    LPC_SC-&amp;gt;PCON = 0x0; // Table 44&lt;br /&gt;
    SCB-&amp;gt;SCR     = 0x0; // Table 662&lt;br /&gt;
    __WFI();&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void enter_deep_sleep()&lt;br /&gt;
 {&lt;br /&gt;
     LPC_SC-&amp;gt;PCON  = 0x8; // Table 44&lt;br /&gt;
     SCB-&amp;gt;SCR     |= 0x4; // Table 662&lt;br /&gt;
     __WFI();&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void enter_powerdown()&lt;br /&gt;
 {&lt;br /&gt;
     LPC_SC-&amp;gt;PCON  = 0x1; // Table 44&lt;br /&gt;
     SCB-&amp;gt;SCR     |= 0x4; // Table 662&lt;br /&gt;
     __WFI();&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void enter_deep_powerdown()&lt;br /&gt;
 {&lt;br /&gt;
     LPC_SC-&amp;gt;PCON  = 0x3; // Table 44&lt;br /&gt;
     SCB-&amp;gt;SCR     |= 0x4; // Table 662&lt;br /&gt;
     __WFI();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Note the use of of __WFI(), which the compiler resolves as the assembly directive &lt;br /&gt;
 __ASM (&amp;quot;wfi&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
=== Exiting ===&lt;br /&gt;
&lt;br /&gt;
On exiting a power mode, the associated bit on the Power Mode Control register must be cleared. As noted in the datasheet, bits 8, 9, 10, and 11 are associated to the particular power modes, and these flags are cleared in software by writing &amp;quot;one&amp;quot; to the associated bit. &lt;br /&gt;
&lt;br /&gt;
 void clear_sleep()          { LPC_SC-&amp;gt;PCON |= 1 &amp;lt;&amp;lt;  8; };&lt;br /&gt;
 void clear_deep_sleep()     { LPC_SC-&amp;gt;PCON |= 1 &amp;lt;&amp;lt;  9; };&lt;br /&gt;
 void clear_powerdown()      { LPC_SC-&amp;gt;PCON |= 1 &amp;lt;&amp;lt; 10; };&lt;br /&gt;
 void clear_deep_powerdown() { LPC_SC-&amp;gt;PCON |= 1 &amp;lt;&amp;lt; 11; };&lt;br /&gt;
&lt;br /&gt;
The PLLs (phase-locked loops) are turned off upon entering deep sleep, power-down, and deep power-down. Additionally, the IRC (the 4 MHz internal reference clock) and the clock dividers are reset when entering power-down and deep power-down. Therefore, the system clocks must be reconfigured/reinitialized when exiting any of these power modes. &lt;br /&gt;
&lt;br /&gt;
We can take advantage of sys_clock_configure() from L0_LowLevel/sys_clock.cpp to perform this initialization.&lt;br /&gt;
&lt;br /&gt;
One more thing to keep in mind regarding power mode exits: when exiting deep sleep, power-down, and deep power-down, there is a non-zero amount of time that must elapse before the system is able to resume processing. In all three cases, a timer starts counting the moment the power mode is exited, and code execution can resume after this timer expires. &lt;br /&gt;
* If the IRC was used prior to entering the power mode, then the 2-bit IRC timer is used, and it lasts is 2&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 4 cycles long.&lt;br /&gt;
* If the main external oscillator was used, then the 12-bit main oscillator timer is used, and it lasts 2&amp;lt;sup&amp;gt;12&amp;lt;/sup&amp;gt; = 4096 cycles long.&lt;br /&gt;
&lt;br /&gt;
Moreover, in power-down and deep power-down, the flash undergoes wake-up, and its wake-up timer must expire (approximately 100 µs) before it can be used. This means that no instructions can be fetched from flash for execution until this timer expires.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a tabulation of the features that are enabled or disabled for each power mode.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Features&lt;br /&gt;
! Sleep&lt;br /&gt;
! Deep-sleep&lt;br /&gt;
! Power-down&lt;br /&gt;
! Deep Power-down&lt;br /&gt;
|-&lt;br /&gt;
| Wake via reset&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Wake via RTC interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Wake via NMI&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via EINT0-3&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via GPIO interrupts&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via Eth WOL interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via brownout detect&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via watchdog timer&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via USB-active interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via CAN-active interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via any other interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
| No&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Main oscillator?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| IRC oscillator?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| RTC oscillator?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Optional&lt;br /&gt;
|-&lt;br /&gt;
| CPU clock?&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Peripheral clocks?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| USB clock?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Watchdog clock?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled*&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| PLLs?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Status of Wake-up Interrupt Controller?&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
|-&lt;br /&gt;
| Status of RTC backup registers?&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
|-&lt;br /&gt;
| Status of on-chip regulator?&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active  or power-down with external circuitry&lt;br /&gt;
|-&lt;br /&gt;
| Status of flash memory?&lt;br /&gt;
| Standby&lt;br /&gt;
| Standby&lt;br /&gt;
| Powered-down&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of processor state?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of processor registers?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of peripheral registers?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of SRAM values?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of chip pin logic levels?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Access to flash memory?&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Access to main SRAM?&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Access to AHB SRAM?&lt;br /&gt;
| Allowed with GPDMA support&lt;br /&gt;
| Allowed with GPDMA support&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Access to peripherals?&lt;br /&gt;
| Allowed with GPDMA support&lt;br /&gt;
| Allowed with GPDMA support&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic power?&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Special instructions after wakeup?&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Resume from last PC?&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No; system restarts&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
[1] NXP Semiconductors. (19 Dec. 2016). ''UM10360: LPC176x/5x user manual.''&lt;br /&gt;
&lt;br /&gt;
[2] NXP Semiconductors. (25 Feb. 2010). ''AN10915: Using the LPC1700 power modes.''&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:MEOW_PCB_schematic.JPG&amp;diff=44913</id>
		<title>File:MEOW PCB schematic.JPG</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:MEOW_PCB_schematic.JPG&amp;diff=44913"/>
				<updated>2018-05-19T22:42:04Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Board_MEOW_schematic.JPG&amp;diff=44912</id>
		<title>File:Board MEOW schematic.JPG</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Board_MEOW_schematic.JPG&amp;diff=44912"/>
				<updated>2018-05-19T22:39:38Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Meow_Eagle_schematic.JPG&amp;diff=44911</id>
		<title>File:Meow Eagle schematic.JPG</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Meow_Eagle_schematic.JPG&amp;diff=44911"/>
				<updated>2018-05-19T22:33:50Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Board_MEOW_schematic_PCB.JPG&amp;diff=44910</id>
		<title>File:Board MEOW schematic PCB.JPG</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Board_MEOW_schematic_PCB.JPG&amp;diff=44910"/>
				<updated>2018-05-19T22:31:29Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Meow_hardware_schematic.JPG&amp;diff=44909</id>
		<title>File:Meow hardware schematic.JPG</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Meow_hardware_schematic.JPG&amp;diff=44909"/>
				<updated>2018-05-19T21:57:46Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44908</id>
		<title>File:IMG 3326.jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44908"/>
				<updated>2018-05-19T21:48:55Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: 146 user15 uploaded a new version of File:IMG 3326.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44907</id>
		<title>File:IMG 3326.jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44907"/>
				<updated>2018-05-19T21:48:05Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: 146 user15 uploaded a new version of File:IMG 3326.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44906</id>
		<title>File:IMG 3326.jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44906"/>
				<updated>2018-05-19T21:30:56Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: 146 user15 uploaded a new version of File:IMG 3326.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44905</id>
		<title>File:IMG 3326.jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44905"/>
				<updated>2018-05-19T21:27:33Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: 146 user15 uploaded a new version of File:IMG 3326.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44904</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44904"/>
				<updated>2018-05-19T21:24:05Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:IMG 3326.jpg|right]]&lt;br /&gt;
=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Our project aims to provide a theft detection service by recording a video when any movement is detected in an immediate vicinity. A video feed is stored on the device to collect later on. The video feed can be used as evidence to provide authority to find the culprit. This report details the system and technology used to implement this project.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
Our primary goal for this project was to learn about the sleep modes that the LPC Microcontoller is capable of. In order to help us understand the functionality of the technology, we wanted to implement the sleep modes on a real life practical example. &lt;br /&gt;
 &lt;br /&gt;
Living in the Bay Area, a highly technological society, most tech employees travel with expensive equipment in their cars. Knowing this thieves consider this a prime area to conduct car robberies. Recently there has been an increase in these car robberies, where it can be hard to catch the criminals who have committed the theft. Often times the robbers work so quickly and discretely that a normal bystander might not consider the act suspicious. Additionally if your car is parked in remote area, far away from city cameras, it can be hard gather any evidence to catch the thief. Video surveillance evidence is highly valuable to an investigator assigned on the case. &lt;br /&gt;
&lt;br /&gt;
Our video surveillance device, records footage if a crime is committed in a customers' car. Sensors in our device activate a camera to start recording when movement is detected. In its idle state, the device is in sleep mode where minimal tasks are being run on the device, which means it saves on a lot of power consumption. Alternatively if the device is constantly polling, this would use up an enormous amount of battery power. Since this device is meant to be running in a car that is not running, it is pertinent to use minimal power unless absolutely necessary to maximize the battery life. &lt;br /&gt;
&lt;br /&gt;
This application can be scaled for any environment; your home, backyard, or even for city use. We can connect it every street lamp with some IOT capabilities resulting in lower crime rate across the city. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
* Research Power consumption capabilities of micro-controllers. &lt;br /&gt;
* Build and implement a video surveillance device to feature the low power methods. &lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;1337fLuFFy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis, System Design   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 03/04&lt;br /&gt;
|&lt;br /&gt;
* Research hardware and software, plan steps. &lt;br /&gt;
* Team Building and Ideas. &lt;br /&gt;
| &lt;br /&gt;
* Decided what the project will entail and the approach.&lt;br /&gt;
* Team member tasks are given.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 03/11&lt;br /&gt;
| &lt;br /&gt;
* Team Research.&lt;br /&gt;
| &lt;br /&gt;
* Individual Research on the subject. Meow Week.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 03/18&lt;br /&gt;
| &lt;br /&gt;
* Give specific tasks to team members.&lt;br /&gt;
* PCB Design.&lt;br /&gt;
* Finalize the project idea.&lt;br /&gt;
| &lt;br /&gt;
* Divided the project into different sections.&lt;br /&gt;
* Assigned roles and responsibilities to each member.&lt;br /&gt;
* Initial PCB design is done in Eagle.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 03/25&lt;br /&gt;
| &lt;br /&gt;
* To finalize PCB, and order components.&lt;br /&gt;
| &lt;br /&gt;
* Ordered Components, PCB was sent for printing.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 04/01&lt;br /&gt;
| &lt;br /&gt;
* Power mode research(different team members different areas).&lt;br /&gt;
* Solder PCB components and test.&lt;br /&gt;
* Modify the architecture and flow of project if necessary.&lt;br /&gt;
| &lt;br /&gt;
* Individual research on power modes initialized.&lt;br /&gt;
* Finished Soldering components on the PCB.&lt;br /&gt;
* Architecture and flow of project modified and implemented.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 04/08&lt;br /&gt;
|&lt;br /&gt;
* Test and Implement the PIR motion sensors and connections.&lt;br /&gt;
* Establish connections between the LPC and Beaglebone.&lt;br /&gt;
| &lt;br /&gt;
* PIR sensor test and implementation done.&lt;br /&gt;
* Interrupt and connections between the two microcontroller boards are done.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 04/15&lt;br /&gt;
|&lt;br /&gt;
* Test all the lower level components.&lt;br /&gt;
* implement the sleep mode and power down modes.&lt;br /&gt;
| &lt;br /&gt;
* Tested the lower level sensors and the power source (PCB and Lipo Battery).&lt;br /&gt;
* Tested and implemented one of the power down modes.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 04/22&lt;br /&gt;
| &lt;br /&gt;
* Prototype of the shell of the project.&lt;br /&gt;
* Write and further test implementation of low power modes.&lt;br /&gt;
|&lt;br /&gt;
* 3D rendering of the prototype done. yet to be printed.&lt;br /&gt;
* Further research and implementation of power modes done. More research needed.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| 04/29&lt;br /&gt;
| &lt;br /&gt;
* Integrate code with PIR and Low Power functionalities&lt;br /&gt;
* Rob Went to Napa Valley.&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* PIR Integration Complete&lt;br /&gt;
* Rob drank wine.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| 05/06&lt;br /&gt;
| &lt;br /&gt;
* Get the Camera and the overall system done.&lt;br /&gt;
* Bitcoin will hit 10000.&lt;br /&gt;
* Test the power consumption of each &lt;br /&gt;
|&lt;br /&gt;
* Testing Power modes complete&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| 05/13&lt;br /&gt;
| &lt;br /&gt;
* MEOW @ PREET&lt;br /&gt;
* Finalize Prototyping and print the housing&lt;br /&gt;
* Collect Images and Video for documentation&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
===== Low-Level Hardware =====&lt;br /&gt;
&lt;br /&gt;
The low-level design starts from the PIR Motion Sensors and ends with the storage of the video data. The LPC1758 plays a big role in the communication of the overall system. The PIR sensors are each connected to the LPC1758 using a GPIO protocol and send signals if an object or and person is within their range. Once the signal is sent from the Sensors, the LPC wakes up and consumes power from the PCB which either uses the power from a plugged source or the backup LIPO battery. LPC then sends the right information to the BeagleBone board using UART protocol.&lt;br /&gt;
&lt;br /&gt;
== NXP LPC1700 Series Power Modes ==&lt;br /&gt;
&lt;br /&gt;
=== Power management functionality in LPC 176x CPU ===&lt;br /&gt;
&lt;br /&gt;
* There are mainly 4 modes of runtime power savings mode that are available in LPC 176x CPU. They are described in details as follows&lt;br /&gt;
**Normal sleep&lt;br /&gt;
**Deep sleep&lt;br /&gt;
**Power Down mode&lt;br /&gt;
**Deep Power mode&lt;br /&gt;
* How to put to sleep&lt;br /&gt;
**WFE (wake from exception) or WFI (wake from interrupt)&lt;br /&gt;
* How to wake up system&lt;br /&gt;
**Wake up interrupt controller (WIC)&lt;br /&gt;
**General interrupts&lt;br /&gt;
&lt;br /&gt;
=== Entering ===&lt;br /&gt;
&lt;br /&gt;
Power mode entry is based on tables 44 (Power Mode Control register) and 662 (SCR bit assignments) of UM10360 [1].&lt;br /&gt;
&lt;br /&gt;
 void enter_sleep()&lt;br /&gt;
 {&lt;br /&gt;
    LPC_SC-&amp;gt;PCON = 0x0; // Table 44&lt;br /&gt;
    SCB-&amp;gt;SCR     = 0x0; // Table 662&lt;br /&gt;
    __WFI();&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void enter_deep_sleep()&lt;br /&gt;
 {&lt;br /&gt;
     LPC_SC-&amp;gt;PCON  = 0x8; // Table 44&lt;br /&gt;
     SCB-&amp;gt;SCR     |= 0x4; // Table 662&lt;br /&gt;
     __WFI();&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void enter_powerdown()&lt;br /&gt;
 {&lt;br /&gt;
     LPC_SC-&amp;gt;PCON  = 0x1; // Table 44&lt;br /&gt;
     SCB-&amp;gt;SCR     |= 0x4; // Table 662&lt;br /&gt;
     __WFI();&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void enter_deep_powerdown()&lt;br /&gt;
 {&lt;br /&gt;
     LPC_SC-&amp;gt;PCON  = 0x3; // Table 44&lt;br /&gt;
     SCB-&amp;gt;SCR     |= 0x4; // Table 662&lt;br /&gt;
     __WFI();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Note the use of of __WFI(), which the compiler resolves as the assembly directive &lt;br /&gt;
 __ASM (&amp;quot;wfi&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
=== Exiting ===&lt;br /&gt;
&lt;br /&gt;
On exiting a power mode, the associated bit on the Power Mode Control register must be cleared. As noted in the datasheet, bits 8, 9, 10, and 11 are associated to the particular power modes, and these flags are cleared in software by writing &amp;quot;one&amp;quot; to the associated bit. &lt;br /&gt;
&lt;br /&gt;
 void clear_sleep()          { LPC_SC-&amp;gt;PCON |= 1 &amp;lt;&amp;lt;  8; };&lt;br /&gt;
 void clear_deep_sleep()     { LPC_SC-&amp;gt;PCON |= 1 &amp;lt;&amp;lt;  9; };&lt;br /&gt;
 void clear_powerdown()      { LPC_SC-&amp;gt;PCON |= 1 &amp;lt;&amp;lt; 10; };&lt;br /&gt;
 void clear_deep_powerdown() { LPC_SC-&amp;gt;PCON |= 1 &amp;lt;&amp;lt; 11; };&lt;br /&gt;
&lt;br /&gt;
The PLLs (phase-locked loops) are turned off upon entering deep sleep, power-down, and deep power-down. Additionally, the IRC (the 4 MHz internal reference clock) and the clock dividers are reset when entering power-down and deep power-down. Therefore, the system clocks must be reconfigured/reinitialized when exiting any of these power modes. &lt;br /&gt;
&lt;br /&gt;
We can take advantage of sys_clock_configure() from L0_LowLevel/sys_clock.cpp to perform this initialization.&lt;br /&gt;
&lt;br /&gt;
One more thing to keep in mind regarding power mode exits: when exiting deep sleep, power-down, and deep power-down, there is a non-zero amount of time that must elapse before the system is able to resume processing. In all three cases, a timer starts counting the moment the power mode is exited, and code execution can resume after this timer expires. &lt;br /&gt;
* If the IRC was used prior to entering the power mode, then the 2-bit IRC timer is used, and it lasts is 2&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; = 4 cycles long.&lt;br /&gt;
* If the main external oscillator was used, then the 12-bit main oscillator timer is used, and it lasts 2&amp;lt;sup&amp;gt;12&amp;lt;/sup&amp;gt; = 4096 cycles long.&lt;br /&gt;
&lt;br /&gt;
Moreover, in power-down and deep power-down, the flash undergoes wake-up, and its wake-up timer must expire (approximately 100 µs) before it can be used. This means that no instructions can be fetched from flash for execution until this timer expires.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a tabulation of the features that are enabled or disabled for each power mode.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Features&lt;br /&gt;
! Sleep&lt;br /&gt;
! Deep-sleep&lt;br /&gt;
! Power-down&lt;br /&gt;
! Deep Power-down&lt;br /&gt;
|-&lt;br /&gt;
| Wake via reset&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Wake via RTC interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Wake via NMI&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via EINT0-3&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via GPIO interrupts&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via Eth WOL interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via brownout detect&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via watchdog timer&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via USB-active interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via CAN-active interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Wake via any other interrupt&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
| No&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Main oscillator?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| IRC oscillator?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| RTC oscillator?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Optional&lt;br /&gt;
|-&lt;br /&gt;
| CPU clock?&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Peripheral clocks?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| USB clock?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Watchdog clock?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled&lt;br /&gt;
| Enabled*&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| PLLs?&lt;br /&gt;
| Enabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Status of Wake-up Interrupt Controller?&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
|-&lt;br /&gt;
| Status of RTC backup registers?&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
|-&lt;br /&gt;
| Status of on-chip regulator?&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active&lt;br /&gt;
| Active  or power-down with external circuitry&lt;br /&gt;
|-&lt;br /&gt;
| Status of flash memory?&lt;br /&gt;
| Standby&lt;br /&gt;
| Standby&lt;br /&gt;
| Powered-down&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of processor state?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of processor registers?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of peripheral registers?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of SRAM values?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Status of chip pin logic levels?&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Preserved&lt;br /&gt;
| Powered-down&lt;br /&gt;
|-&lt;br /&gt;
| Access to flash memory?&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Access to main SRAM?&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Access to AHB SRAM?&lt;br /&gt;
| Allowed with GPDMA support&lt;br /&gt;
| Allowed with GPDMA support&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Access to peripherals?&lt;br /&gt;
| Allowed with GPDMA support&lt;br /&gt;
| Allowed with GPDMA support&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic power?&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
| Disabled&lt;br /&gt;
|-&lt;br /&gt;
| Special instructions after wakeup?&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Resume from last PC?&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No; system restarts&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
[1] NXP Semiconductors. (19 Dec. 2016). ''UM10360: LPC176x/5x user manual.''&lt;br /&gt;
&lt;br /&gt;
[2] NXP Semiconductors. (25 Feb. 2010). ''AN10915: Using the LPC1700 power modes.''&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44903</id>
		<title>File:IMG 3326.jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:IMG_3326.jpg&amp;diff=44903"/>
				<updated>2018-05-19T21:21:12Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:IMG_3326_(1).jpg&amp;diff=44902</id>
		<title>File:IMG 3326 (1).jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:IMG_3326_(1).jpg&amp;diff=44902"/>
				<updated>2018-05-19T21:15:50Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:IMG_3324_(1).jpg&amp;diff=44901</id>
		<title>File:IMG 3324 (1).jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:IMG_3324_(1).jpg&amp;diff=44901"/>
				<updated>2018-05-19T21:13:47Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Meow_picture1.jpg&amp;diff=44900</id>
		<title>File:Meow picture1.jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Meow_picture1.jpg&amp;diff=44900"/>
				<updated>2018-05-19T21:05:18Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Meow_picture.jpg&amp;diff=44899</id>
		<title>File:Meow picture.jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Meow_picture.jpg&amp;diff=44899"/>
				<updated>2018-05-19T21:04:11Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44567</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44567"/>
				<updated>2018-05-01T09:02:44Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;fluffy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 03/04&lt;br /&gt;
|&lt;br /&gt;
* Research hardware and software, plan steps. &lt;br /&gt;
* Team Building and Ideas. &lt;br /&gt;
| &lt;br /&gt;
* Decided what the project will entail and the approach.&lt;br /&gt;
* Team member tasks are given.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 03/11&lt;br /&gt;
| &lt;br /&gt;
* Team Research.&lt;br /&gt;
| &lt;br /&gt;
* Individual Research on the subject. Meow Week.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 03/18&lt;br /&gt;
| &lt;br /&gt;
* Give specific tasks to team members.&lt;br /&gt;
* PCB Design.&lt;br /&gt;
* Finalize the project idea.&lt;br /&gt;
| &lt;br /&gt;
* Divided the project into different sections.&lt;br /&gt;
* Assigned roles and responsibilities to each member.&lt;br /&gt;
* Initial PCB design is done in Eagle.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 03/25&lt;br /&gt;
| &lt;br /&gt;
* To finalize PCB, and order components.&lt;br /&gt;
| &lt;br /&gt;
* Ordered Components, PCB was sent for printing.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 04/01&lt;br /&gt;
| &lt;br /&gt;
* Power mode research(different team members different areas).&lt;br /&gt;
* Solder PCB components and test.&lt;br /&gt;
* Modify the architecture and flow of project if necessary.&lt;br /&gt;
| &lt;br /&gt;
* Individual research on power modes initialized.&lt;br /&gt;
* Finished Soldering components on the PCB.&lt;br /&gt;
* Architecture and flow of project modified and implemented.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 04/08&lt;br /&gt;
|&lt;br /&gt;
* Test and Implement the PIR motion sensors and connections.&lt;br /&gt;
* Establish connections between the LPC and Beaglebone.&lt;br /&gt;
| &lt;br /&gt;
* PIR sensor test and implementation done.&lt;br /&gt;
* Interrupt and connections between the two microcontroller boards are done.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 04/15&lt;br /&gt;
|&lt;br /&gt;
* Test all the lower level components.&lt;br /&gt;
* implement the sleep mode and power down modes.&lt;br /&gt;
| &lt;br /&gt;
* Tested the lower level sensors and the power source (PCB and Lipo Battery).&lt;br /&gt;
* Tested and implemented one of the power down modes.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 04/22&lt;br /&gt;
| &lt;br /&gt;
* Prototype of the shell of the project.&lt;br /&gt;
* write and further test implementation of low power modes.&lt;br /&gt;
|&lt;br /&gt;
* 3d rendering of the prototype done. yet to be printed.&lt;br /&gt;
* further research and implementation of power modes done. More research needed.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| 04/29&lt;br /&gt;
| &lt;br /&gt;
* Rob Went to Napa Valley.&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Rob drank wine.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| 05/06&lt;br /&gt;
| &lt;br /&gt;
* Get the Camera and the overall system done.&lt;br /&gt;
* Bitcoin will hit 10000.&lt;br /&gt;
* Test the power consumption of each &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| 05/13&lt;br /&gt;
| &lt;br /&gt;
* MEOW @ PREET&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
===== Low-Level Hardware =====&lt;br /&gt;
&lt;br /&gt;
The low-level design starts from the PIR Motion Sensors and ends with the storage of the video data. The LPC1758 plays a big role in the communication of the overall system. The PIR sensors are each connected to the LPC1758 using a GPIO protocol and send signals if an object or and person is within their range. Once the signal is sent from the Sensors, the LPC wakes up and consumes power from the PCB which either uses the power from a plugged source or the backup LIPO battery. LPC then sends the right information to the BeagleBone board using UART protocol.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44302</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44302"/>
				<updated>2018-04-17T09:27:28Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Low-Level Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;fluffy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Week&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Completion Date&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
|week1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
* Finalize project &lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
===== Low-Level Hardware =====&lt;br /&gt;
&lt;br /&gt;
The low-level design starts from the PIR Motion Sensors and ends with the storage of the video data. The LPC1758 plays a big role in the communication of the overall system. The PIR sensors are each connected to the LPC1758 using a GPIO protocol and send signals if an object or and person is within their range. Once the signal is sent from the Sensors, the LPC wakes up and consumes power from the PCB which either uses the power from a plugged source or the backup LIPO battery. LPC then sends the right information to the BeagleBone board using UART protocol.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44301</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44301"/>
				<updated>2018-04-17T09:26:53Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Hardware Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;fluffy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Week&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Completion Date&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
|week1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
* Finalize project &lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
===== Low-Level Hardware =====&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44300</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44300"/>
				<updated>2018-04-17T09:26:30Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Hardware Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;fluffy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Week&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Completion Date&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
|week1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
* Finalize project &lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
===== Hardware Design =====&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44299</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44299"/>
				<updated>2018-04-17T09:26:18Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Hardware Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;fluffy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Week&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Completion Date&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
|week1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
* Finalize project &lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44298</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44298"/>
				<updated>2018-04-17T09:25:45Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Low Level Hardware Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;fluffy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Week&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Completion Date&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
|week1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
* Finalize project &lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44297</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44297"/>
				<updated>2018-04-17T09:25:00Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Low Level Hardware Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;fluffy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Week&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Completion Date&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
|week1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
* Finalize project &lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
== Low Level Hardware Design ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44296</id>
		<title>S18: M.E.O.W</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=S18:_M.E.O.W&amp;diff=44296"/>
				<updated>2018-04-17T09:24:42Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Hardware Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Microcontroller Energy Observation Widget (M.E.O.W) ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R &amp;quot;Meow Meow&amp;quot; Nikfar&lt;br /&gt;
**Team Lead, PCB Design, Sensor Design and Implementation, Hardware Testing, Power Analysis, Sleep-Mode Firmware &lt;br /&gt;
*  Ahsan &amp;quot;Whiskers&amp;quot; Uddin&lt;br /&gt;
**BeagleBone Testing, Video Capture Implementation, Storage, Sleep-Mode Research   &lt;br /&gt;
*  Nelson &amp;quot;fluffy&amp;quot; Wong&lt;br /&gt;
**Deep Power Modes, Power Analysis, Communications   &lt;br /&gt;
*  Britto &amp;quot;Kitty Kat&amp;quot; Thomas&lt;br /&gt;
**CAN BUS Low Power Research, Power Analysis   &lt;br /&gt;
*  Sai Kiran &amp;quot;Mittens&amp;quot; Rachamadugu&lt;br /&gt;
**Testing, Board Communications, User Interface&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Week&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Completion Date&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
|week1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
* Finalize project &lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Low Level Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=User:146_user15&amp;diff=39765</id>
		<title>User:146 user15</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=User:146_user15&amp;diff=39765"/>
				<updated>2017-09-22T22:22:49Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: Created page with &amp;quot;=== Grading Criteria === &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt; *  How well is Software &amp;amp; Hardware Design described? *  How well can this report be used to reproduce this project? *  Code Quali...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Yaron Alexandrovich&lt;br /&gt;
**   &lt;br /&gt;
*  Emil Kurian&lt;br /&gt;
**   &lt;br /&gt;
*  Gerard Ramos&lt;br /&gt;
**   &lt;br /&gt;
*  Fred Sun&lt;br /&gt;
**   &lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/8&lt;br /&gt;
| Task list&lt;br /&gt;
| Completed?  Problems Encountered?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== My Issue #1 ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Embedded_Systems_Learning_Academy:Users&amp;diff=39764</id>
		<title>Embedded Systems Learning Academy:Users</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Embedded_Systems_Learning_Academy:Users&amp;diff=39764"/>
				<updated>2017-09-22T22:16:17Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: Created page with &amp;quot;=== Grading Criteria === &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt; *  How well is Software &amp;amp; Hardware Design described? *  How well can this report be used to reproduce this project? *  Code Quali...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
This section should be a couple lines to describe what your project does.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Yaron Alexandrovich&lt;br /&gt;
**   &lt;br /&gt;
*  Emil Kurian&lt;br /&gt;
**   &lt;br /&gt;
*  Gerard Ramos&lt;br /&gt;
**   &lt;br /&gt;
*  Fred Sun&lt;br /&gt;
**   &lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/8&lt;br /&gt;
| Task list&lt;br /&gt;
| Completed?  Problems Encountered?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== My Issue #1 ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learned from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34146</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34146"/>
				<updated>2016-12-21T01:59:38Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* CAN Bus */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when the bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that the data was successfully received. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority node is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the initialization sequence of the display driver. First, the I2C protocol is initialized in order to set up the communication between the SJ One board and the OLED display. Afterwards, the initial contents of the buffer are displayed to the screen. The buffer initially contains a bitmap image of the Adafruit Logo, this splash screen image is to be displayed upon boot up as requested by the manufacturer. The process of writing the buffer to the display consists of of sending each entry in the buffer to the display over the I2C bus. After some time delay, the display splash screen is cleared and the display becomes ready for interfacing.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|720 px|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the writing sequence of the display driver. First, the display is prepared for the writing sequence through a series of register writes. The purpose of these register writes is to configure the rows and columns that are to be used by the display. Afterwards, the string is dissected and saved to the buffer. Finally, the buffer is written to the display one character at a time over the I2C bus.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.socialledge.com/sjsu/index.php?title=CAN_BUS_Tutorial CAN Bus Tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34144</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34144"/>
				<updated>2016-12-21T01:59:15Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the initialization sequence of the display driver. First, the I2C protocol is initialized in order to set up the communication between the SJ One board and the OLED display. Afterwards, the initial contents of the buffer are displayed to the screen. The buffer initially contains a bitmap image of the Adafruit Logo, this splash screen image is to be displayed upon boot up as requested by the manufacturer. The process of writing the buffer to the display consists of of sending each entry in the buffer to the display over the I2C bus. After some time delay, the display splash screen is cleared and the display becomes ready for interfacing.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|720 px|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the writing sequence of the display driver. First, the display is prepared for the writing sequence through a series of register writes. The purpose of these register writes is to configure the rows and columns that are to be used by the display. Afterwards, the string is dissected and saved to the buffer. Finally, the buffer is written to the display one character at a time over the I2C bus.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.socialledge.com/sjsu/index.php?title=CAN_BUS_Tutorial CAN Bus Tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34143</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34143"/>
				<updated>2016-12-21T01:59:01Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the initialization sequence of the display driver. First, the I2C protocol is initialized in order to set up the communication between the SJ One board and the OLED display. Afterwards, the initial contents of the buffer are displayed to the screen. The buffer initially contains a bitmap image of the Adafruit Logo, this splash screen image is to be displayed upon boot up as requested by the manufacturer. The process of writing the buffer to the display consists of of sending each entry in the buffer to the display over the I2C bus. After some time delay, the display splash screen is cleared and the display becomes ready for interfacing.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|720 px|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the writing sequence of the display driver. First, the display is prepared for the writing sequence through a series of register writes. The purpose of these register writes is to configure the rows and columns that are to be used by the display. Afterwards, the string is dissected and saved to the buffer. Finally, the buffer is written to the display one character at a time over the I2C bus.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|50px|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.socialledge.com/sjsu/index.php?title=CAN_BUS_Tutorial CAN Bus Tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34140</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34140"/>
				<updated>2016-12-21T01:58:11Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the initialization sequence of the display driver. First, the I2C protocol is initialized in order to set up the communication between the SJ One board and the OLED display. Afterwards, the initial contents of the buffer are displayed to the screen. The buffer initially contains a bitmap image of the Adafruit Logo, this splash screen image is to be displayed upon boot up as requested by the manufacturer. The process of writing the buffer to the display consists of of sending each entry in the buffer to the display over the I2C bus. After some time delay, the display splash screen is cleared and the display becomes ready for interfacing.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|720 px|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the writing sequence of the display driver. First, the display is prepared for the writing sequence through a series of register writes. The purpose of these register writes is to configure the rows and columns that are to be used by the display. Afterwards, the string is dissected and saved to the buffer. Finally, the buffer is written to the display one character at a time over the I2C bus.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.socialledge.com/sjsu/index.php?title=CAN_BUS_Tutorial CAN Bus Tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34123</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34123"/>
				<updated>2016-12-21T01:55:26Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* References Used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the initialization sequence of the display driver. First, the I2C protocol is initialized in order to set up the communication between the SJ One board and the OLED display. Afterwards, the initial contents of the buffer are displayed to the screen. The buffer initially contains a bitmap image of the Adafruit Logo, this splash screen image is to be displayed upon boot up as requested by the manufacturer. The process of writing the buffer to the display consists of of sending each entry in the buffer to the display over the I2C bus. After some time delay, the display splash screen is cleared and the display becomes ready for interfacing.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the writing sequence of the display driver. First, the display is prepared for the writing sequence through a series of register writes. The purpose of these register writes is to configure the rows and columns that are to be used by the display. Afterwards, the string is dissected and saved to the buffer. Finally, the buffer is written to the display one character at a time over the I2C bus.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.socialledge.com/sjsu/index.php?title=CAN_BUS_Tutorial CAN Bus Tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34120</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34120"/>
				<updated>2016-12-21T01:54:33Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the initialization sequence of the display driver. First, the I2C protocol is initialized in order to set up the communication between the SJ One board and the OLED display. Afterwards, the initial contents of the buffer are displayed to the screen. The buffer initially contains a bitmap image of the Adafruit Logo, this splash screen image is to be displayed upon boot up as requested by the manufacturer. The process of writing the buffer to the display consists of of sending each entry in the buffer to the display over the I2C bus. After some time delay, the display splash screen is cleared and the display becomes ready for interfacing.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the writing sequence of the display driver. First, the display is prepared for the writing sequence through a series of register writes. The purpose of these register writes is to configure the rows and columns that are to be used by the display. Afterwards, the string is dissected and saved to the buffer. Finally, the buffer is written to the display one character at a time over the I2C bus.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34117</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34117"/>
				<updated>2016-12-21T01:52:05Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the initialization sequence of the display driver. First, the I2C protocol is initialized in order to set up the communication between the SJ One board and the OLED display. Afterwards, the initial contents of the buffer are displayed to the screen. The buffer initially contains a bitmap image of the Adafruit Logo, this splash screen image is to be displayed upon boot up as requested by the manufacturer. The process of writing the buffer to the display consists of of sending each entry in the buffer over the I2C bus. After some time delay, the display splash screen is cleared and thus the display is ready to be interfaced with.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the writing sequence of the display driver. First, the display is prepared for the writing sequence through a series of register writes. The purpose of these register writes is to configure the rows and columns that are to be used by the display. Afterwards, the string is dissected and saved to the buffer. Finally, the buffer is written to the display one character at a time over the I2C bus.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34115</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34115"/>
				<updated>2016-12-21T01:51:34Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the initialization sequence of the display driver. First, the I2C protocol is initialized in order to set up the communication between the SJ One board and the OLED display. Afterwards, the initial contents of the buffer are displayed to the screen. The buffer initially contains a bitmap image of the Adafruit Logo, this splash screen image is to be displayed upon boot up as requested by the manufacturer. The process of writing the buffer to the display consists of of sending each entry in the buffer over the I2C bus. After some time delay, the display splash screen is cleared and thus the display is ready to be interfaced with.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the functions utilized in the writing sequence of the display driver. First, the display is prepared for the writing sequence through a series of register writes. The purpose of these register writes is to configure the rows and columns that are to be used by the display. Afterwards, the string is dissected and saved to the buffer. Finally, the buffer is written to the display one character at a time.&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34088</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34088"/>
				<updated>2016-12-21T01:44:44Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* References Used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34085</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34085"/>
				<updated>2016-12-21T01:44:29Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Appendix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34064</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34064"/>
				<updated>2016-12-21T01:37:45Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Project Source Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com/cmpe146f16g1/OBD2Reader Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34055</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34055"/>
				<updated>2016-12-21T01:33:45Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Hardware Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port. A 120 ohms resistor was connected to the CAN High and CAN Low on the transceiver's side in order to prevent any signals from reflecting. The other end already contained a 120 ohm resistor in the ECU. &lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34046</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34046"/>
				<updated>2016-12-21T01:31:12Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.png|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.png|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34044</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34044"/>
				<updated>2016-12-21T01:30:44Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWInit.jpg|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDSWDisplay.jpg|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34043</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34043"/>
				<updated>2016-12-21T01:30:18Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_COLEDSWInit.jpg|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_COLEDSWDisplay.jpg|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34041</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=34041"/>
				<updated>2016-12-21T01:29:54Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_COLEDSWInit.jpg|center|thumb|Figure 11. OLED display software initialization sequence]]&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_COLEDSWDisplay.jpg|center|thumb|Figure 12. OLED display writing sequence]]&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 13. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:CmpE146_F16_G1_OLEDSWDisplay.png&amp;diff=34030</id>
		<title>File:CmpE146 F16 G1 OLEDSWDisplay.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:CmpE146_F16_G1_OLEDSWDisplay.png&amp;diff=34030"/>
				<updated>2016-12-21T01:26:57Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: CmpE146, Fall 2016, Group 1. OLED Display Write Sequence Software Diagram.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CmpE146, Fall 2016, Group 1. OLED Display Write Sequence Software Diagram.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:CmpE146_F16_G1_OLEDSWInit.png&amp;diff=34027</id>
		<title>File:CmpE146 F16 G1 OLEDSWInit.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:CmpE146_F16_G1_OLEDSWInit.png&amp;diff=34027"/>
				<updated>2016-12-21T01:26:11Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: CmpE146, Fall 2016, Group 1. OLED Display Initialization Sequence Diagram.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CmpE146, Fall 2016, Group 1. OLED Display Initialization Sequence Diagram.&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33984</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33984"/>
				<updated>2016-12-21T00:59:36Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Design &amp;amp; Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The following sub-sections describe the hardware and software design configurations that were utilized in this project.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 11. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33980</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33980"/>
				<updated>2016-12-21T00:58:44Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Parts List &amp;amp; Cost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 11. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33977</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33977"/>
				<updated>2016-12-21T00:57:30Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Hardware Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol. A CAN bus transceiver was connected to the Rx and Tx output pins of the SJ One board so that the signals voltage levels could be converted to CAN bus appropriate levels. The transceiver output CAN High and CAN Low signals are then connected to the DB9 pins of the OBD2 to DB9 adapter so that the CAN High and CAN Low signals can be transmitted to the vehicle's OBD2 port.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJ One board master device. The SJ One board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 11. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33971</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33971"/>
				<updated>2016-12-21T00:54:50Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Video */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. &lt;br /&gt;
&lt;br /&gt;
The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJOne board master device. The SJOne board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 11. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Video Demo]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33967</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33967"/>
				<updated>2016-12-21T00:53:47Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. &lt;br /&gt;
&lt;br /&gt;
The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJOne board master device. The SJOne board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|Figure 11. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33965</id>
		<title>F16: OBD2 Reader</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F16:_OBD2_Reader&amp;diff=33965"/>
				<updated>2016-12-21T00:53:32Z</updated>
		
		<summary type="html">&lt;p&gt;146 user15: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Abstract ==&lt;br /&gt;
This project entails the use of can bus structure to create a form of communication between our Microcontroller and a vehicle's ECU. Once connected using this protocol, our Microcontroller using the Can controller will interface with the ECU and retrieve diagnostic information stored in the ECU for debbuging. Once these codes are stored in our memory location on the Microcontroller, we will reset the diagnostic data of the ECU and clear the check engine on the car.  &lt;br /&gt;
using a transceiver and OBD2 protocol. The OBD2 codes retrieved from the vehicle are&lt;br /&gt;
compared to the Microcontroller's database. If there is a match, a corresponding&lt;br /&gt;
message is displayed to the user via an LCD screen. The LCD screen will use the I2C protocol to transmit the data from our Microcontroller to the LCD screen. These messages will entail diagnostic data and instructions.&lt;br /&gt;
&lt;br /&gt;
==OBD2 Reader==&lt;br /&gt;
&lt;br /&gt;
On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.&lt;br /&gt;
&lt;br /&gt;
The OBD2 reader is an on board diagnostic device that translates the diagnostic code&lt;br /&gt;
from a vehicle's engine control unit (ECU) to comprehensible data for the user. This &lt;br /&gt;
device employed several protocols from CMPE 146 lab and techniques taken from&lt;br /&gt;
the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data &lt;br /&gt;
from several sensors and units and translates it into hexadecimal numbers that it then&lt;br /&gt;
outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic&lt;br /&gt;
information from it, which it then transmits to the microcontroller which in turn compares&lt;br /&gt;
the information to its database codes and print a message that explains what the code means.&lt;br /&gt;
If the codes from the ECU match the code stored on our board, the board will display the result &lt;br /&gt;
on Hercules and an LCD device that was configured with out system. The LCD device was implemented &lt;br /&gt;
on top of our board using the I2C protocol; it display the error message corresponding to the &lt;br /&gt;
vehicle's obd code as well as diagnostic suggestions and further steps to take.&lt;br /&gt;
&lt;br /&gt;
==CAN Bus==&lt;br /&gt;
Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and Microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD2 connector.&lt;br /&gt;
&lt;br /&gt;
[[File:CAN H L.png|center|frame|Figure 1. CAN Bus wiring]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Bus Wiring.png|center|frame|Figure 2. CAN Bus Communication]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 Microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the Microcontroller send out logical signals that need to be converted to a single differential pair which connects to the OBD2 port. &lt;br /&gt;
&lt;br /&gt;
[[File:CAN Frame.png|center|frame|Figure 3. CAN Bus Frame]]&lt;br /&gt;
&lt;br /&gt;
The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
&lt;br /&gt;
This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an OLED screen. &lt;br /&gt;
&lt;br /&gt;
Objectives:&lt;br /&gt;
&lt;br /&gt;
* Interface the SJOne board with the OBD2 reader&lt;br /&gt;
* Store and read external memory module through SJOne board&lt;br /&gt;
* Interfacing SJOne to external OLED display&lt;br /&gt;
&lt;br /&gt;
Sensors and Peripherals Used:&lt;br /&gt;
&lt;br /&gt;
* ECU (information source device)&lt;br /&gt;
* SJOne (for processing information)&lt;br /&gt;
* External Memory and Memory Interface&lt;br /&gt;
* OLED (display vehicle diagnostics)&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  R Nikfar&lt;br /&gt;
** Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.  &lt;br /&gt;
*  Samira Oliva&lt;br /&gt;
** CAN Driver Programming and Setting up the memory unit.&lt;br /&gt;
*  Samuel Palomino&lt;br /&gt;
** CAN Driver Programming, OLED Display Driver Programming and Component Debugging.&lt;br /&gt;
*  Erik Sanchez&lt;br /&gt;
** Setting up the memory unit.&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Planned Tasks&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Actual Outcome&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 10/30/16&lt;br /&gt;
| 11/05/16&lt;br /&gt;
| &lt;br /&gt;
* Project proposal&lt;br /&gt;
* Research parts&lt;br /&gt;
* Order basic parts&lt;br /&gt;
* Rough design&lt;br /&gt;
| Completed&lt;br /&gt;
| &lt;br /&gt;
* Proposal approved.&lt;br /&gt;
* Purchased OBD2 to DB9 adapter.&lt;br /&gt;
* Ordered OLED Display.&lt;br /&gt;
* Finalized group logistics.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 11/06/16&lt;br /&gt;
| 11/12/16&lt;br /&gt;
|&lt;br /&gt;
* Order remaining parts&lt;br /&gt;
* Finalize design&lt;br /&gt;
* Generate schematic&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| 11/13/16&lt;br /&gt;
| 11/19/16&lt;br /&gt;
|&lt;br /&gt;
* Set up interface OBD2 to SJOne&lt;br /&gt;
* Set up interface SJOne to external memory&lt;br /&gt;
* Set up interface SJOne to OLED display module&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 11/20/16&lt;br /&gt;
| 11/26/16&lt;br /&gt;
|&lt;br /&gt;
* Decode OBD2 outputs using external memory&lt;br /&gt;
* Fetch &amp;amp; store procedures with external memory&lt;br /&gt;
* Implement display module driver software&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| 11/27/16&lt;br /&gt;
| 12/03/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize fetch &amp;amp; store procedures&lt;br /&gt;
* Integrate display module driver with fetched data&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| 12/04/16&lt;br /&gt;
| 12/10/16&lt;br /&gt;
|&lt;br /&gt;
* Finalize software interface&lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Create housing/enclosure box for system&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| 12/11/16&lt;br /&gt;
| 12/17/16&lt;br /&gt;
| &lt;br /&gt;
* Debugging &amp;amp; testing&lt;br /&gt;
* Write Report&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| 12/18/16&lt;br /&gt;
| 12/20/16&lt;br /&gt;
|&lt;br /&gt;
* Finish report&lt;br /&gt;
* Demo Presentation&lt;br /&gt;
| Completed&lt;br /&gt;
| Completed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty.&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Price (Total)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| SJOne Board&lt;br /&gt;
| 1&lt;br /&gt;
| $80.00&lt;br /&gt;
| [http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board SJSU]&lt;br /&gt;
| SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CAN Transceiver&lt;br /&gt;
| 1&lt;br /&gt;
| $1.68&lt;br /&gt;
| [http://www.mouser.com/ProductDetail/Texas-Instruments/SN65HVDA1040AQDRQ1/?qs=sGAEpiMZZMsGqoCZrYwANnALgco3oYte5umc1d%2fVHOg%3d Mouser]&lt;br /&gt;
| Handles CAN bus signals voltage conversion&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OBD2 to DB9 Adapter&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
| [https://www.amazon.com/Adapter-Cable-Connecting-Diagnostic-Interface-Compliant/dp/B007UKTW8E/ref=sr_1_2?ie=UTF8&amp;amp;qid=1482279496 Amazon]&lt;br /&gt;
| Connects the vehicle's ECU to SJOne board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| OLED Display&lt;br /&gt;
| 1&lt;br /&gt;
| $9.99&lt;br /&gt;
| [https://www.amazon.com/Diymall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE/ref=sr_1_4?ie=UTF8&amp;amp;qid=1482279570 Amazon]&lt;br /&gt;
| I2C 128x64 Display Module&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:CmpE146_F16_G1_SN65Module.jpg|Figure 4. SN65HVD1040 CAN Transceiver&lt;br /&gt;
File:CmpE146_F16_G1_OBD2DB9.jpg|Figure 5. OBD2 to DB9 Adapter&lt;br /&gt;
File:CmpE146_F16_G1_OLEDModule.jpg|Figure 6. OLED Display Module&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_HWDesign.png|512px|right|thumb|Figure 7. System Design]]&lt;br /&gt;
&lt;br /&gt;
Our system consists of four major components: the SJ One board, the CAN bus transceiver, the vehicle's ECU and an OLED display. In order for the SJ One board to successfully communicate with the vehicle's ECU over the CAN bus, a CAN bus transceiver was required. The OLED display acts a simple visual aid to help the user visualize what commands are being sent and what data is being received. &lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_CANDesign.jpg|200px|right|thumb|Figure 8. Hardware Interface with CAN Bus]]&lt;br /&gt;
&lt;br /&gt;
[[File:CmpE146_F16_G1_OLEDDesign.jpg|200px|right|thumb|Figure 9. Hardware Interface with OLED Display]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
The SJ One board is able to communicate with the vehicle's ECU using the CAN bus protocol.&lt;br /&gt;
&lt;br /&gt;
The OLED display module consists of the actual OLED display along with an SSD1306 controller chip which drives the display. Implementing the OLED module required a thorough understanding of the initialization and communication procedures laid out by the controller chip's datasheet. &lt;br /&gt;
&lt;br /&gt;
The SSD1306 acts as a slave device on the I2C bus as it communicates with the SJOne board master device. The SJOne board writes to a series of registers on the SSD1306 to control the display.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
The program consists of a CAN task class derived from the scheduler_task class. This class is used to configure a driver for the CAN protocol. This single task takes care of preparing the bus for communication and also the message transmission and reception. First, the CAN bus is initialized. Then, the CAN bus is set up so that all messages on the bus are received. There is no need to filter the messages traveling on the CAN bus as there are only two devices on our bus. Finally, the CAN bus is reset so that it's ready for communication. This concludes the set up portion of the CAN bus. &lt;br /&gt;
&lt;br /&gt;
Additionally, the program communicates with an external OLED display to easily see which CAN messages are being sent and received.  Doing so allowed for ease of verifying what data is being sent and received by the system. The OLED display is directly interacted with through the single task in our program since the display contents rely on the CAN bus data.&lt;br /&gt;
&lt;br /&gt;
* Communication Protocols:&lt;br /&gt;
** Controller Area Network (CAN)&lt;br /&gt;
*** Communicates with the vehicle's ECU.&lt;br /&gt;
** I2C&lt;br /&gt;
*** Communicates with the OLED display.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* CAN Implementation&lt;br /&gt;
&lt;br /&gt;
The following diagram shows the overall flow of actions in the CAN driver: initializing the CAN Bus, filter settings, reset, &lt;br /&gt;
and the task running that consists of bus resetting, transmission, and reception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_CANDriver.jpg|center|thumb|Figure 10. Can Driver Software Overview]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* OLED Display Implementation&lt;br /&gt;
A series of commands must be issued to the SSD1306 in order to prepare the display for operation. The commands are issued as a series of register writes over the I2C bus from the SJ One board master device to the SSD1306 slave device. The registers that are to be written to for implementing the initialization sequence are shown in the following table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Register&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Command Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAE&lt;br /&gt;
| Turn the display off&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD5&lt;br /&gt;
| Set SSD1306 oscillator frequency&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA8&lt;br /&gt;
| Set MUX Ratio&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD3&lt;br /&gt;
| Set display offset&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x40&lt;br /&gt;
| Set display start line&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x8D&lt;br /&gt;
| Set SSD1306 to be powered by the module's regulator&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x20&lt;br /&gt;
| Set horizontal addressing mode&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA0&lt;br /&gt;
| Set columns to be mapped to display segments&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xC0&lt;br /&gt;
| Set COM scan from top to bottom&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDA&lt;br /&gt;
| Set COM pins hardware configuration&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0x81&lt;br /&gt;
| Set contrast control&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xD9&lt;br /&gt;
| Set pre-charge period&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xDB&lt;br /&gt;
| Set Vcom deselect level&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA4&lt;br /&gt;
| Set display to replicate contents in RAM&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xA6&lt;br /&gt;
| Set display to normal (no color inversion)&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0xAF&lt;br /&gt;
| Turn the display on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Memory Unit&lt;br /&gt;
&lt;br /&gt;
An SD card was used to store a file containing OBDII codes. This was necessary&lt;br /&gt;
in order to perform file IO and process the codes in an array. The array used&lt;br /&gt;
by the driver to search for a tranmitted OBD code. If found, the corresponding &lt;br /&gt;
message is written. Alternatives to this approach entail using the on-board memory.&lt;br /&gt;
&lt;br /&gt;
[[File:CMPE146_F16_G1_SDCard.jpg|center|thumb|50px|Figure 11. SD Card]]&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== Issue #1 ===&lt;br /&gt;
&lt;br /&gt;
The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we sought to advise of the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there are about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.&lt;br /&gt;
&lt;br /&gt;
=== Issue #2 ===&lt;br /&gt;
&lt;br /&gt;
The second Issue included the lack of information regarding the architecture of the can bus protocol. we originally connected the Tx, Rx from The Microcontroller directly to the can bus Hi and Lo Signals. After several days of troubleshooting, we realized that there would be a need for the specific transceivers(automotive). These transceivers would operate at a much higher frequency than our previous transceivers(500kbps).&lt;br /&gt;
&lt;br /&gt;
=== Issue #3 ===&lt;br /&gt;
&lt;br /&gt;
After much research, it was determined that the maximum speed of the Microcontroller would not be enough for the Automotive can bus architecture. The Microcontroller's stable speed(100kbps) was much lower than automotive(500kbps). In order to fix this problem, and outside crystal was connected to the board Xtal pin.&lt;br /&gt;
&lt;br /&gt;
=== Issue #4 ===&lt;br /&gt;
&lt;br /&gt;
Once the physical connection with the vehicle was made and hexadecimal messages were being sent through the can bus, we ran into another issue. The connectors on the J2284 or OBD2 pin to the ECU were not properly marked. This was the most vexing of all the issues due to the ambiguous nature of the problem. We trouble shooted the board, the signal and ultimately were able to narrow the problem down to wrong connection labels(manufacturer error).&lt;br /&gt;
&lt;br /&gt;
=== Issue #5 ===&lt;br /&gt;
&lt;br /&gt;
Our last problem entailed the implementation of the software. Using given structure of the can bus we were able to create a task and store and transmit values that were not intended. This was mostly due to a wrong implementation of a function designed to convert the values of from the controller to memory. The external memory implementation was removed, and we were able to get the right hex code outputs on the Hercules terminal.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
This project vastly improved our understanding of the LPC1758 Can Controller, Can bus architecture, Automotive standards, PID's, I2C standard, LCD interfacing, and Configuration of the Can system. This project ultimately helped our team understand several topics not mentioned in this class, and further prepared each team member to understand the troubleshooting procedures necessary when dealing with an automotive vehicle. The team was successful in retrieving the diagnostic codes from the designated vehicle and reset the check engine light of the vehicle. Our goal for the future is to create a pragmatic device that could be used to interface with a software application or platform.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
*  [https://github.com Github Project Repository]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=yAEXL-Hv8nQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
* Many thanks to Praveen Prabhakaran, CMPE 146 lab TA for assisting us with questions in regards to File IO&lt;br /&gt;
with the LPC and CAN Bus.&lt;br /&gt;
* Many thanks to Professor Kang, CMPE 146 lab instructor for teaching us the fundamentals of embedded systems&lt;br /&gt;
programming.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;br /&gt;
&lt;br /&gt;
* [http://www.ti.com/lit/ds/symlink/sn65hvda1040a-q1.pdf SN65HVDA1040 CAN Transceiver Datasheet]&lt;br /&gt;
&lt;br /&gt;
* [https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf OLED Display Datasheet]&lt;/div&gt;</summary>
		<author><name>146 user15</name></author>	</entry>

	</feed>