1. Attachments are working again! Check out this thread for more details and to report any other bugs.

My Duinomite Mega Canview V4 equivalent Project

Discussion in 'Prius PHEV Plug-In Modifications' started by lopezjm2001, Jul 19, 2012.

?
  1. Yes

    11 vote(s)
    100.0%
  2. Prefer to use Android Torque device

    0 vote(s)
    0.0%
  3. Prefer to use Scangauge

    0 vote(s)
    0.0%
  1. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    407
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    My latest update to this project is working on defining the flag bits in CANbus messages H348 and H3C8.
    I am using my miniVCI using Techstream software on my notebook and compare it with my Duinomite Mega test page.
    So far I have identified and verified against Techstream that (ICE ECU) H3C8 byte 0, bit 2 is the "ICE WARM-UP REQUEST".

    I am still working on finding the responce bit in H348 by the HV ECU. (WIP).

    So as soon as you start your Prius with a cold ICE the HV ECU will give you a short period of time (say about 2 seconds) to press the EV button. When READY the ICE ECU sends a "WARM UP REQUEST" flag regardless. If you do not press the EV button within that short period of time the HV ECU will acknowledge the warm up request with a flag bit "WARMING UP REQUEST" and then the ICE will start.
     
    planetaire and jdh2550 like this.
  2. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    58&59 correlate with the PIC's datasheet for CAN channel 1, 80&81 don't appear to match the datasheet for this channel nor for channel 2 (which, if I'm reading the datasheet correctly (and remembering correctly) is 29&21). UPDATE: different chips in use on DM and UBW32/CGCOLORMAX (per TBS discussion) - so updated software will be required. When you get the device I'll make sure you get an updated version of the MMBasic interpreter with CAN-b2.

    I do plan on expanding my CAN commands to support both channels (even though only channel 1 is commonly used) - this will let me test out my hardware before creating new firmware for my new battery ECU controller (see YaPIP thread). So, as long as you can tie the hardware to the right pins then the software will work.

    If, for whatever reason, you can't access the right pins you can go with plan B - use the Arduino shield which has a CAN Controller and Transceiver combo. I imagine this is driven via SPI - but I haven't looked in detail.
     
    [email protected] likes this.
  3. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    After thinking about this a little more - and assuming you still want to program in BASIC - plan B won't work very well for you. None of the CAN commands (mine or Frank's) will work with an external shield. It would be a complete re-write - the implementation would need to have it's own HAL to work with either the native CAN controller or an external one that is interface by some arbitrary protocol.

    So, let's hope the right pins are exposed on the CGCOLORMAX1...
     
  4. Flying White Dutchman

    Flying White Dutchman Senior Member

    Joined:
    Dec 29, 2007
    4,374
    313
    0
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    Yes

    I think the sparkfun serial lcd would be the best thing to get.



    -Tapatalk
     
  5. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    407
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    There is not much point in having a prototype area unless you have access to all the vacant pins of the PIC32. Apart from a vague description I have no idea what the board looks like as there are no pictures available yet..
     
  6. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    407
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    Fantastic!!!

    EDITED: Hi JDH2550 - I get the impression that Geoff only wants to release MM basic 4.X with CAN commands using the RX and TX pins for a Color Maximite PIC32. Which probably means that he will not release a MMbasic 4.X with CAN commands that will work with the Duinomite Mega. Is my assumption wrong?
     
  7. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    I think he's going to release a version for all three platforms: Color Maximite, UBW32 and Duinomite Mega. In fact, AFAIK, the only version that's actually implemented right now is the Duinomite Mega.

    There may need to be a fourth version for DM eMega (which I think is the same chip as the CMM and UBW32 - whereas the DM Mega (no e) is the same chip as the MM (no colour)). Confused yet? o_O
     
  8. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    407
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
  9. Flying White Dutchman

    Flying White Dutchman Senior Member

    Joined:
    Dec 29, 2007
    4,374
    313
    0
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    Nice

    Great work.

    The sceen is getting a little busy but it all seems to run smoothly..

    -Tapatalk
     
  10. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    407
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    I have added another page for CANbus data analysis. As shown below.
    F8dataanalisyspage.jpg
    The first line of data is live and the following lines are recorded data for every instance a H348 or H3C8 flag byte changes. The lines scroll from top to bottom whilst the most bottom line of data happened last.

    Unfortunately I have almost used up the maximum number of subroutines allowed by MMbasic 4.0 so there is not much room left. I do not want to split the program over a number of files and swap files whilst driving due to the relays dropping out causing the ICE to start. But what I will do is add a PROJECT folder containing the BASIC code for the different pages/functions which can be added or taken away as you like. EDITED: I worked out that Gosubs/return do not count as user defined subroutines which are limited to a maximum of 64 so I converted some of my user defined subroutines to normal subrouties using Gosub - Return.
     
  11. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    407
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    Hi JDH2550,

    At this point I would like to connect my Lilliputt touch screen/7'' LCD monitor to the RS232 port of the Duinomite Mega for touch screen control. As you are a Software Engineer I am wondering if this can be done. I could use a USB to RS232 adaptor or a UART to USB adaptor. What do you think? I know you have a Lilliputt screen so I was wondering if you had considered doing this. The GPIO has two UART comms 1 and 2 RX and TX. Could these be used with a USB.
    The last option I want to use is connecting the touchscreen 4 wire resistance connections directly to the Duinomite Mega GPIO. Any advice? I will also ask Norm for advice. Thanks.
     
  12. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    Hi JLo,

    Nope, you're not going to be able to use USB in this way. Those USB/RS232 converters are client devices designed to give USB hosts ports. You can't plug the Liliput into the USB side because the screen is a client device. The DMM is actually a host device - but to be able to plug the screen's USB into the DMM you'd need to write drivers. It would be an interesting project - but a difficult one.

    A direct connection of the 4 wires I think it the best approach. You won't actually connect to GPIO (which are digital pins) - you need to connect to the A/D converters - I don't know what resolution A/D will be required.
     
    [email protected] likes this.
  13. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    407
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    Bummer. The problem with this approach is that once it is done I cannot use the touchscreen with my original Canview V4.0 by Norm. Actually I could install a cable directly to the touch screen four wire resistance panel and may need a four-pole toggle switch to isolate the touch panel driver PCB so this way I could still use the Lilliput screen for both Norm's and the Duinomite Mega's Canview V4.0.

    EDITED: I am thinking of just getting a numeric keypad like this one NUMERIC KEYPAD - USB/PS2 | eBay
    Or a programmable keypad like this one Cherry G84 4700 Programmable Keypad Squirrel Grey PS2 G84 4701TNAUS | eBay
     
  14. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    407
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    I am now adding F9 - DATA LOGGER which will start recording data of all the variables into a CSV file "B:DATA.CSV" on the micro SD card. Then later the data file can be used to create graphs using Microsoft Excel. I will be using the MMbasic 4.0 timer function to include a time stamp in the first column. It will probably log once per second. The DATA.CSV file will be replaced everytime the logging function is started so to save it the file name needs to be changed.

    The BASIC code is very simple and straight forward as shown below:

    Code:
      Dim ECT : Dim ICE : Dim timermem : ECT = 30 : ICE = 50
      Open "b:data.csv" For output As 1
      Write #1,"TIME","ECT","ICE"
      Timer=0 : timermem=0
      Do While ECT>1
        If Timer => (timermem+1000) Then
          ECT=ECT-1 : ICE=ICE-1
          Write #1,Timer/1000,ECT,ICE                ' WRITE VALUES TO SD CARD
          Print Format$(Timer/1000,"%0.0f"),ECT,ICE  ' WRITE VALUES TO SCREEN
          timermem=Timer
        EndIf
      Loop
      Close #1
    The result is shown below:

    DATACSV.PNG

    EDITED: Due to BASIC program restrictions I have had to split the DATA.CSV file into four seperate data files i.e. DATA1.CSV, DATA2.CSV, DATA3.CSV and DATA4.CSV.
    DATA1.CSV - general variables.
    DATA2.CSV - general variables
    DATA3.CSV - bytes and flags
    DATA4.CSV - temperatures
     
  15. Flying White Dutchman

    Flying White Dutchman Senior Member

    Joined:
    Dec 29, 2007
    4,374
    313
    0
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
  16. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    Check out this thread on TBS: The Back Shed: Small VGA monitor - TassyJim has the touchscreen working.
     
  17. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    407
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    I have been following this thread on thebackshed. I am not keen on having to modify my Lilliput screen to expose the touch screen resistance wires. But it is Good to know that there is a working BASIC program available using an interrupt. I may attempt it later. Thanks.
    EDITED: Maybe add a second touch screen.
     
  18. Flying White Dutchman

    Flying White Dutchman Senior Member

    Joined:
    Dec 29, 2007
    4,374
    313
    0
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    i discovered something new .

    i booted the duinomite and my program was gone...
    the sd card was not corrupted and al file except one where on it...
    strange...
     
  19. NortTexSalv04Prius

    NortTexSalv04Prius Active Member

    Joined:
    Nov 14, 2009
    915
    114
    0
    Location:
    Texas
    Vehicle:
    2004 Prius
    Model:
    N/A
  20. Flying White Dutchman

    Flying White Dutchman Senior Member

    Joined:
    Dec 29, 2007
    4,374
    313
    0
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    lopez is there a way to go past the can waiting screen if there is no canbus connected for bench testing things like relays and buttons

    i want to connect a button to Digital pin11 as a input so setpin 11,2 and connect a switch to ground to it go from 1 to 0
    then i put "If Pin(11) = 0 Then F4() ' F4 - PHEV/ORIG BUTTON - Pressing the user button toggles between PHEV and ORIGINAL mode"

    into the code to i have a hardwired Phev toggle switch

    EDIT

    i got it .
    just removed the canbus lines

    and the button is working..

    maybe this weekend putting it in.

    I do see one thing when i toggle between PHEV and ORG the set voltages go back to 195 or 238 volts
    it would be better that they stay at what the user changed them to with the up and down buttons.

    also does this send the code to the BMS+/2 that its in the NEW mode where the SOC stays high longer or wil this still be the OLD code where the spoofed SOC is dropping faster