Control an SPI display with a Cinterion GPS Modem
Posted by blogElectronica in 2.DISPOSITIVOS (práctico), 3.GENERAL, Comunic. GSM/GPRSI recently had to help out on a fleet control project where they needed to control a small screen via a MTX65+G modem. As I had to make a small mount to test the screen/display that I was using, I’m sharing it on here for anyone else who may need it in the future (and to remind myself if I ever need it again).
Let’s go. As many of you will remember, the MTX65+G modem has a single serial port. That serial port was already occupied by another device, so the only alternative was to use a display controlled by SPI. The chosen screen was from Electronic Assembly and more specifically it is the EA DIP204-4HNLED model.
The first thing to do with this screen is configure it so that it works with SPI as by default it uses a parallel bus. To do this you simply have to turn it around, unsolder the jumper marked 4/8 and solder the jumper marked SPI. Both are close together and one should be secured with a multi-meter so that the 4/8 jumper is really unsoldered.
The display connections are very simple, so quick that I connected pins 17 and 18 to 4V power supply (for the backlight), pins 1 and 2 to 3.3V and the contrast (pin 3) to a 10K potentiometer and the 4-pin SPI bus (pins 4, 5, 6 and 7) to the corresponding modem’s SPI bus (obviously the screen’s DI to the modem’s DO and vice versa). For my tests, I used a MTX65-IND terminal as it was convenient, but it would be exactly the same if you used an MTX65 or an MTX65+G. Well that’s almost everything, we just need to send the appropriate AT commands to the modem so that it sends data to the display via SPI and so that you can write on it. Obviously all of this can be done from a java embedded application inside the modem, but for convenience, I am going to do it via AT commands sent from a PC application through the serial port. So, these are the exact commands that you need to send in order to write HOLA on the screen.
‘Activate the SPI bus and put it in 0 mode (of four possible modes)
Response = sendAT (“at ^ sspi = 1000,0000,0000,0000,0000″)
’8bits and activate the extended functions
Response = sendSerial (“<2000000F820C0>”)
’4 line mode
Response = sendSerial (“<2000000F89000>”)
8 bits and disable the extended functions
Response = sendSerial (“<2000000F800C0>”)
‘Display on, cursor on and blinking cursor
Response = sendSerial (“<2000000F8F000>”)
‘We clean display and cursor column 1 and row 1
Response = sendSerial (“<2000000F88000>”)
‘To move the cursor to each write
Response = sendSerial (“<2000000F86000>”)
‘We wrote HOLA
Response = sendSerial (“<2000000FA1020>”) ‘H
Response = sendSerial (“<2000000FAF020>”) ‘O
Response = sendSerial (“<2000000FA3020>”) ‘L
Response = sendSerial (“<2000000FA8020>”) ‘A
I didn’t make anything up, it’s basically the example from the display’s manual (page 3). The only thing to keep in mind is that you have to send the smallest bit first and the biggest bit last. I.e. in the manual’s example, you send a 0×34 command, which in binary is 0011 0100. Therefore, with our modem, we will have to send 0010 1100 i.e. a 2C. Another important thing is that the screen requires each byte to be sent divided into two bytes e.g. XXXX0000 XXXX0000, therefore instead of sending a 2C, a 20C0 is sent. The reason for the initial F8 in each frame (or the official FA when we write a character) is explained here in page 51, it’s basically the header in each SPI frame, which the screen needs.
Just this is enough to write data on the screen like you can see on the picture above.
I hope that it’s been interesting or helpful for those who need to use a display with a Siemens/Cinterion modem on a project.
Speaking of Siemens/Cinterion, I’ll tell you about some good news that affects me personally and in these times, good news is always welcome. It turns out that this week it was celebrated at the global congress that Cinterion organizes with all of its distributors. As I have mentioned in my blog many times, I work for Matrix Electrónica (Cinterion distributor in Spain) as an application engineer. So, this year we have been awarded a prize for the best distributor in the world with the best technical support for Cinterion modems, something due to both my colleague Jesús Santos, the server that writes to you (which we are principally in charge of) and among other things from the Cinterion technical support and MTX terminals in Matrix. We are very pleased.
It feels good. After working for so many hours with these products, always lending a hand to so many people (we’ve had hundreds of queries from companies with all types of GSM projects) and always being willing to resolve problems, without burying our heads in the sand. Finally, after all of our hard work, we have at least been recognized by Cinterion, the truth is that it makes us feel good and encourages us to continue and improve even more.
My granddad, God rest his soul, often used to say gratitude is a sign of a good upbringing. So thanks to Antonio López (from Cinterion Spain) that has always been there to lend a hand whenever we have needed it and whose help has been invaluable and fundamental to be able to do our work well during this time.
That’s all for today, see you next time. Hope you have a good Sunday.
Tags: cinterion, matrix, pantallas lcd