.

Dependencies:   SDHCFileSystem mbed

Files at this revision

API Documentation at this revision

Comitter:
TickTock
Date:
Tue Dec 04 04:20:24 2012 +0000
Parent:
6:594d9717e609
Child:
8:6872945e8e91
Commit message:
Successfully captured EV & CAN logs from car. Buffer appears to overflow, though (LED4 blinks faster than LED3)

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Dec 03 14:04:54 2012 +0000
+++ b/main.cpp	Tue Dec 04 04:20:24 2012 +0000
@@ -8,22 +8,25 @@
 //CANcan.cpp
 
 //LEAF OBD
-//1:
+//1:                
 //2:
 //3:    AVCAN-L     White/Blue
-//4:
+//4:   
 //5:    VSS         Brown,White/Brown
-//6:    CARCAN-H    Green
+//6:    CARCAN-H    Green                   --> VP230b:7
 //7:
 //8:    12V-SW      Orange,White/Orange
 //9:
 //10:
 //11:   AVCAN-H     Blue
-//12:   EVCAN-L     White/Grey
-//13:   EVCAN-H     Grey
-//14:   CARCAN-L    White/Green
-//15:
-//16:   12V-AON     Red/Blue,Blue/Red
+//12:   EVCAN-L     White/Grey              --> VP230a:6
+//13:   EVCAN-H     Grey                    --> VP230a:7
+//14:   CARCAN-L    White/Green             --> VP230b:6
+//15:                                     6V
+//16:   12V-AON     Red/Blue,Blue/Red ----|<---- LPC1768:2
+//note 1: pins 4 & 5 longer
+//note 2: pins 12 & 13 next to key
+//note 3: pins 1 & 9 on right side looking into male connector with key on bottom
 
 //VP230
 //1:D   
@@ -31,13 +34,13 @@
 //3:VCC 
 //4:R   
 //5:Vref
-//6:CANL
-//7:CANH
-//8:RS
+//6:CANL        --> OBD:12,14
+//7:CANH        --> OBD:13,6
+//8:RS          --> LPC1768:27,28
 
 //LPC1768
-//1:    VSS
-//2:        NC:VIN  (4.5-9V supply)
+//1:    VSS                             6V
+//2:        NC:VIN  (4.5-9V supply) ---->|---- OBD:16
 //3:        NC:VB
 //4:        NC:nR
 //5:    SPI:MOSI   -->  6:SDRAM:DI
@@ -85,8 +88,8 @@
 DigitalIn  CD(p17); 
 DigitalIn  PB1( p20 );
 SDFileSystem sd(p5, p6, p7, p8, "sd" ); // SDFileSystem::SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name)
-Ticker ticker1;
-Ticker ticker2;
+//Ticker ticker1;
+//Ticker ticker2;
 Timer timer;
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
@@ -251,12 +254,12 @@
 int main() {
     pc.baud(460800);        // change serial interface to pc to 115200, 8N1
     CANMessage tsMsg;
-    can1.frequency(1000000);
-    can2.frequency(1000000);
-    can1_SleepMode = 0;         // Enable TX
-    can2_SleepMode = 0;         // Enable TX
-    //can1_SleepMode = 1;         // Turn on Monitor_only Mode
-    //can2_SleepMode = 1;         // Turn on Monitor_only Mode
+    can1.frequency(500000);
+    can2.frequency(500000);
+    //can1_SleepMode = 0;         // Enable TX
+    //can2_SleepMode = 0;         // Enable TX
+    can1_SleepMode = 1;         // Turn on Monitor_only Mode
+    can2_SleepMode = 1;         // Turn on Monitor_only Mode
     CD.mode(PullUp) ; //SDRAM Chip Detect
     PB1.mode(PullUp) ; //Pushbutton 1
     can1.attach(&recieve1);
@@ -298,14 +301,14 @@
                 logCan(0,tsMsg); //write full timestamp
                 fclose(file);
             }
-            ticker1.attach(&send1, .0052); //start sending messages
-            ticker2.attach(&send2, .0051); //start sending messages
+            //ticker1.attach(&send1, .0052); //start sending messages
+            //ticker2.attach(&send2, .0051); //start sending messages
             
             while ((PB1==1)&&(CD==1)){
                 wait(0.25); // Keep logging until button pushed or SDRAM removed
             }
-            ticker1.detach();
-            ticker2.detach();
+            //ticker1.detach();
+            //ticker2.detach();
             logOpen=false;
             pc.printf("Stopping log\n\n");
             wait(1);