Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Sun Aug 20, 2023 3:33 pm
by Gregski
forgive me if I don't word this properly, so please be gentle, the goal is to have the Lexus GS450h ver. 2 hardware VCU write / send output to a 1602 LCD display using an I2C adapter or a Nextion display which requires Serial output in the form of RX TX
Using Damien's gs450h_v3_user code I can see three different Serial implementations inside of it
SerialDEBUG.begin(115200);
this one uses a USB cable to serve up the Menu on our laptops and is used for us to troubleshoot
I am tempted to try using this one with a USB to serial cable adapter to write to the LCD/I2C adapter or Nextion display
Serial1.begin(250000);
this one appears to "//read mth" so something to do with Inverter control which is way over my head and probably not something to be messed with
Serial2.begin(19200); //setup serial 2 for wifi access
this one talks to that little red card so that we can see some virtual gauges, is there a way to reassign those pins? or can I just wire to those pins
the red boad is an ESP8266 WiFi card that comes with the Lexus GS450h ver 2 VCU, despite it's 10 pin header/connector, only 4 pins are used (3.3v, Ground, Rx, and Tx)
This is a 1602 LCD (prints 16 characters across and 2 rows) in the back it has an I2C adapter to minimize the number of cables needed to connect to it, without the I2C adapter you would need like 16 cables to write to the thing.
This is the smallest 2.4" Nextion display
This is a USB to TTL adapter that maybe I can use as a man in the middle to get the output from the USB plug on the VCU and send it to either the LCD or the Nextion
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Sun Aug 20, 2023 4:33 pm
by Gregski
this is the pin out for the little Olimex red WiFi card called MOD-WIFI-ESP8266 it talks to the VCU using UART aka Rx Tx and holds the key to the entire operation, if we learn the pin out, we can tap into 3 of it's 10 pins and get Tx that's all we need as we just want to send stuff out, and 3.3v and Ground to power our display gizmos
A UART (Universal Asynchronous Receiver/Transmitter) is the microchip with programming that controls a computer's interface to its attached serial devices.
"The idea of MOD-WIFI-ESP8266 is to use it as an easy hardware expansion of existing Olimex boards. That is why it has UEXT connector. You plug it in another board with UEXT connector and the hardware connections are complete. It is visible in the schematics that MOD-WIFI-ESP8266 uses only first 4 pins of the UEXT – #1 (3.3 Vcc), #2 (GND), #3 (RXD), #4 (TXD). This means only a data UART interface is available. The rest of the pins of the chip are not routed..."
UEXTPINS.jpg (51.18 KiB) Viewed 12055 times
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Sun Aug 20, 2023 5:49 pm
by royhen99
All the above would either need modifiying the SAM3X code to get the correct format on serialdebug to drive the Nextion display or an external processor to covert from async serial to Nextion/I2C. I think the suggestion from a few days ago of using CAN bus and arduino would be best. This would also allow driving both displays together if needed.
I found a simple example on github of CAN to Nextion display. https://github.com/DefinitiveDiagnosis- ... xtion-Dash
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Sun Aug 20, 2023 11:30 pm
by Gregski
after spending many hours I will never get back I got it working
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 9:19 am
by Mhs
Nicely done sir, do you mind sharing high-level on how you made that happen? Was it only "programming" the nextion display to read the existing code or you had to recode the VCU?
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 1:32 pm
by Gregski
Mhs wrote: ↑Mon Aug 21, 2023 9:19 am
Nicely done sir, do you mind sharing high-level on how you made that happen? Was it only "programming" the nextion display to read the existing code or you had to recode the VCU?
In short this was a major pain in the @ss to figure out primarily because the Nextion is a touch screen and can be used as an input device, so all the tutorials and examples I watched on YoutTube were overly complicated and usually were going the other way and showing you how to send data from the Nextion display to the Arduino. Having suffered through all that I will gladly share what I have learned.
We will divide what it takes to send data from the VCU (aka an Atmel controller Arduino) to the Nextion display into two Parts.
Part 1 - the stuff you have to do to the Nextion display using their free software called Nextion Editor.
Part 2 - the stuff you have to do to the VCU using Arduino's free software called IDE (Integrated Development Environment)
don't be skierd it aint that bad
nextion logo.png (3.09 KiB) Viewed 12218 times
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 1:53 pm
by Gregski
We will start by setting up the GUI Graphical User Interface, well more like formatting the display to receive the data. This is going to be simple one text box which will just be a label for the second box which will hold a number.
The first thing you have to do in the Nextion Editor is create a New HMI file
this is what the main Nextion Editor screen looks like, it can be overwhelming at first
after you click on New on the menu bar and give the HMI file some name, I just called this one Tutorial.HMI you get asked these follow up questions.
1. what size Nextion device did you buy and are planning on using?
I just bought their smallest one to start with so the 2.4"
2. Next you will be asked to pick a display I think this is a bit of a language barrier thing as they clearly mean orientation, so pick horizontal, or whatever you want
after that your main work area will look like this
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 1:58 pm
by Gregski
We have to take care of one more "housekeeping" type of item and then we are ready to design our display. For some odd reason the Nextion Editor does not have a default font so we have to create a font, it's easy
click on Tool \ Font Generator
in that box that pops up I just take care of two things, first I select the height which is what they are calling font size, say 24
then I select the Font: Arial
and then I simply name it something like Arial24 and they make you save it as a file
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 2:08 pm
by Gregski
here is how we add a Text field, from the Toolbox on the left just click on Text, that will drop a Text field on your canvas, you can use your mouse to position it where you want so move it around
what's important to note, is the Name of this object aka objname=t0 this is what we will need when we write the Arduino code (sketch) for the VCU if we want to manipulate aka change this textbox
note how programmers wrote this interface cause all the objects use the array counting format, where they start at zero, so the first object is 0 the second object is 1, the third object will be 2, don't let that throw you off
in addition to the name of the object, we want to pay attention to the txt attritube of it where it says txt=newtxt this is the value of the text field, if we want it to read something else than "newtxt" we would type it in this box or later change the txt attribute to that, more on this in a bit
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 2:51 pm
by Gregski
this is a good time to mention Nextion's practice facility aka Debug
this is where you can learn, discover, and test Nextion's commands and syntax
for Example we are going to change the value of our first text box called t0 using it's txt variable, note how after you type an objects name and type a dot the Editor will suggest what attributes are available to that object
here is the syntax for changing the value of what I call a text box, note the quotes, they are super uber important to Nextion so learn to respect them, ha ha
t01.txt="test"
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 2:53 pm
by Gregski
Fun Fact: You can send numbers as well as text from Arduino aka your VCU to the Nextion Display, it doesn't care, as long as you don't plan on doing some calculations or computations using those numbers in Nextion, if it's just for display it is fine.
ARDUINIO ====> NEXTION
text ==> text OK
int ==> text OK
float ==> text OK
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 2:57 pm
by Gregski
OK, now let's add a number box to the Nextion display
We start out the same way and just click the Number doo dad on the Toolbox on the left, however note a new Attribute in the right window pane, numbers don't have the .txt attribute they use the .val attribute instead
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 3:06 pm
by Gregski
alright let's fire up Debug our training facility and see if we can have our way with a number box
Hey we just added our first number box why does it say n0 and not n1?
once again we start typing the object's name n0 then type a period and the Nextion Editor suggests or displays the available Attributes to that object, we want .val because we want to change the value of this number field from zero to something else, lets say 11
to change the value of a number field we type the name of the number box and set its val attribute equal to that number (no quotes for numbers !) Yes, the syntax will drive you bananas!!!
n0.val=11
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 3:20 pm
by Gregski
Lesson Learned: So I expected either of these boxes to have an attribute called: "Label" you know to show next to or above each box to tell us what the hewk goes in there, but that's not how Nextion works, so for our boxes to have Labels we really need to add two more text boxes and these will just be "hard coded" if you will in Nextion and their values we will NOT be changing with code in Arduino, let me just show you a sample display with two "Label" text fields added. I am just going to slide our two boxes to the right first.
So here is just a more practical Example in Debug mode (less cluttered) of what the hell I am talking about when I say labels:
this little display is actually made up of 4 objects, three of them are text boxes and one is a number box. The two on the left are what I call hard coded text boxes where you type in their .txt values in Nextion Editor and just leave it, if you ever want to change them you have to come back to the Nextion Editor and make the changes type of deal. The two boxes on the right are dynamic, meaning their values ie what they end up displaying will be driven by the code from the VCU, hope that makes sense.
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 3:33 pm
by Gregski
CAUTION: the next object is what Nextion calls an Xfloat but it aint what you think and it don't work the way you think, so we aint even gonna worry about it, I just wanted to throw that out there!
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 3:49 pm
by Gregski
Alright keeping it simple, that's all we need for demonstration purposes, just one text box and one number box. However all we done did so far is created an output design on our computers, great! now how do we get that to the actual little Nextion device?
We have two options:
1. we can run over to Best Buy and hope to buy a 32 GB or smaller Micro SD card with it's little regular SD card adapter, and hope our laptop or computer has a SD card reader, or we have to buy a friggen SD card reader (this way is a major pain in the @ss)
OR
2. we can buy one of them "C-3PO" USB to TTL adapters and use it to tether our laptops/computers to the Nextion display deviceseses
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 4:08 pm
by Gregski
so now that you've stolen the micro SD card from your little step sisters camcorder and shoved it into a regular SD adapter and then put that in to your laptop or computer's SD card reader, now what?
Now we need to click on File and TFT file output, we will basically be creating yet another file and this time saving this one to the micro SD card
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 4:12 pm
by Gregski
at this point you yank the micro SD card out of your computer, yank it out of the regular SD card adapter and shove it in the Nextion display... did I mention this was a pain in the @ss !
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 4:21 pm
by Gregski
now we need to just power up (no data communication required at this point) the Nextion, for that we use their comical USB to serial? adapter
[rant] I swear the effort they went through to make this thing they could have just added a USB port to the darn display the way the Display Gods intended [/rant]
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 4:29 pm
by Gregski
after we power up the Nextion with the micro SD card inserted we hope to see an Update Succeeded message
[forgive me for the blurry pics up ahead, I'm a dad, and as such I am only allowed to use our daughters old hand me down steam powered iPhones]
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 4:32 pm
by Gregski
as you work more and more with Nextion and accumulate more TFT files you may be treated to one of these self explanatory errors: joy !
which is super simple and not annoying at all to remedy, all you have to do is: power off the Nextion, remove the micro SD card, insert it into a regular SD card adapter, insert that into your SD card reader in your pc or laptop, open up File Exploder and delete that other TFT file, then simply, remove the ... you get the idea !!!
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 4:36 pm
by Gregski
so then we power off the Nextion, remove the micro SD card, and fire it back up, and then after all that commotion, we have this:
... the Nextion display is ready to receive data, and we are finally ready to fandangle with the code on the VCU or an Arduino (Uno, Due, Mega, whatever)
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 4:43 pm
by Gregski
but wait, didn't you say there was another way to get the display formatting to the Nextion device? surely it has to be more better
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 5:19 pm
by Gregski
you can go out to your favorite jungle like website and drop some coin like I did not a USB to UART (TTL as some call it, Transitor-Transistor Logic) adapter dongle pig tail thingie
HiLetgo CP2102 USB 2.0 to TTL Module Serial Converter Adapter Module USB to TTL Downloader with Jumper Wires
Re: Newb Asks: Does the Lexus GS450h VCU have any Serial Pins for Communication?
Posted: Mon Aug 21, 2023 5:44 pm
by Gregski
so this CP2102 USB to TTL adapter needs some "universal" CP2102 drivers available from SILICON LABS
Product Description
CP2102 USB 2.0 to TTL Module Serial Converter With Free cable
Description:
1. This is a USB 2.0 to TTL UART 6PIN CP2102 Module Serial Converter. Connect MCU easily to your computer!
2. Stable and reliable chipset CP2102
3. USB specification 2.0 compliant with full-speed 12Mbps.
4. Standard USB type A male and TTL 6pin connector. 6pins for 3.3V, RST, TXD, RXD, GND & 5V.
5. All handshaking and modem interface signals.
6. Baud rates: 300 bps to 1.5 Mbps.
7. Byte receive buffer; 640 byte transmit buffer.
8. Hardware or X-On/X-Off handshaking supported.
9. Event character support Line break transmission.
10. USB suspend states supported via SUSPEND pins.
11. Temperature Range: -40 to +85.
12. Supports Windows 98SE, 2000, XP, Vista, Window7, Mac OS 9, Mac OS X & Linux 2.40.
Note:
Please install the following driver to work in Win 10. https://www.silabs.com/documents/public/software/CP210x_Universal_Windows_Driver.zip
I thought this would be automagically detected as a USB drive on my Windows computer but it's not it's a COM port thingie, so I just want to share what it will look like in Device Manager: Silicon Labs CP210x USB to UART Bridge (COMxx)