CharLCD Sample for PSoC 6 (CY8CKIT-062-BLE)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

IMG_4708.JPG

Hi,

While ago, we had a discussion asking for charLCD sample for PSoC 6.

https://community.cypress.com/t5/PSoC-6-MCU/Display-LCD-on-PSOC-6/m-p/266274

And to my surprise, I could not find a charLCD component for PSoC 6 in PSoC Creator.

Adding on top this, the querist was showing 5V LCD in the block diagram,

so I suggested that he needs to use a 3.3V version to go with PSoC 6.

And if I had stopped there, I felt somewhat flighty, so I ordered "my" 3.3V LCD.

The good news is the parts arrived pretty soon,

but the bad news was I could not afford time to fight with it.

 

Finally, today, here is my first sample of charLCD like LCD control sample.

 

The schematic

002-schematic.JPG

The Pins

003-Pins.JPG

Tera Term log

001-TeraTerm.JPG

For the command(s) please refer to the instruction of HD44780U Datasheet

Note: Sorry, I did not implement "read" function.

004-HD44780U_instructions.JPG

1-Mar-2021

moto

14-Oct-2021 Attached project updated

(1) Added delay before initializing the LCD

(2) When DB7 is high in writing,  clear DB7 after write phase is done to prevent the program from hang.

 

 

19 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @MotooTanaka ,

Thank you for sharing this example project with the community. This is a very sought after example project, it will be very beneficial to all our community users 🙂

Regards,
Dheeraj

Hi,

I need help in interfacing this display with the Psoc 5LP.

I am facing difficulties in configuring the SPI block in PSoc Creator and also can't find any APIs for interfacing with the LCD!!

Could you guys help me out or refer some resources from where I could learn?

 

Thanks,

Parth

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I wonder if the following sample can be some hint for you?

https://community.cypress.com/t5/Code-Examples/A-dumb-typewriter-sample-I2C-keyboard-and-SPI-TFT/m-p...

moto

0 Likes

Hi @MotooTanaka ,

 

Could you please share the TFT Source and Header Files with me which you used in the project?

 

 

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I'm  very sorry that I overlooked your request.

Both the source and the header are included in the attached project.

tft_cardkb_200324.cydsn

sources

font

TFT

TFT.c <-- source

TFT.h <-- header

moto

 

 

 

0 Likes
theaaronm
Level 2
Level 2
10 sign-ins 5 replies posted 5 questions asked

Hi @MotooTanaka ,

I am attempting to integrate an LCD into a project I am creating using the CY8CPROTO-063-BLE board and the CYBLE-416045-02 microcontroller. I am able to map what I believe are the correct pins and program the CM4 core. However, when I use the Putty Terminal I can only get the help message to display and can not write anything onto the LCD. Do you have any advice on how to proceed?

 

Thank you,

Aaron

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear Aaron-san,

Could you check the followings?

(1) Is your LCD 3.3V version?

(2) Have you populated a pot at Vo (and +3.3V and GND) ?

(3) If (2) is yes, when you change the value of the POT

     do you see black boxes when the POT is high and nothing when POT is low?

Best Regards,

12-Oct-2021

Motoo Tanaka

0 Likes

(1) I am unsure if it is a 3.3V version, it is from an Arduino kit and the only markings it has on it are '1602A'

(2) I have populated a pot at Vo (and +3.3V and GND).

(3) When I change the value of the POT to high, I get faint black boxes on the top line. When the POT is low I see nothing.

 

Thank you,

Aaron

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

(1) I am unsure if it is a 3.3V version, it is from an Arduino kit and the only markings it has on it are '1602A'

If it's from an Arduino kit, most likely it's a 5V version.

I have both 3.3V and 5V versions

3.3V

https://www.amazon.co.jp/gp/product/B07B24PD33/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

5V

https://www.amazon.co.jp/gp/product/B010GXB9NM/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

And today I tried both but I could now see letters on 5V version with this program and the one for CY8CPROTO-063-BLE.

So this was the first issue, you had, but it was my bad that there were a few more issues with this sample.

(2) Compared with the PSoC board, the LCD board takes longer to be ready,

 so I was halting the program with debugger and started if after a while, in Feb.

Today I modified the program to wait a while for the LCD module, so it should work without this tweak.

(3) Since DB7 is used for both data input and busy output, if data input has MSB of nibble high(1) the program halted. So I needed to write 0 to DB7 after write sequence is done.

Anyway, I posted the CY8CPROTO-062-BLE version in the discussion below.

https://community.cypress.com/t5/Code-Examples/CharLCD-Sample-for-PSOC-6-CY8CPROTO-063-BLE/m-p/29101...

 

moto

 

0 Likes
RAMAKRISHNA
Level 1
Level 1
First reply posted 10 sign-ins 5 sign-ins

Hi MotooTanaka

i am using the modus toolbox 3.1 version. EVK Model is CY8CPROTO-062-4343W .

can you provide the sample code .

0 Likes
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Although I could control CharLCD with PSoC Creator, doing  the same  with MTB took this long ;-(

IMG_5630.JPG

My problem was that I was trying to initialize GPIO pins for the CharLCD as

	cyhal_gpio_init((CLCD_DB7), CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, 0) ;


Today I finally decide to grab my oscilloscope and found that all GPIOs for CharLCD are dead.

By tracing the cyhal sources, finally I realized that I need to "free" the pin before initializing it.

So I added cyhal_gpio_free() before cyhal_gpio_init() and my program started working.

	cyhal_gpio_free(CLCD_DB7) ;

	cyhal_gpio_init((CLCD_DB7), CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, 0) ;

Since my project is about 266MB, it won't be possible to upload the project here,

I attach my main.c, clcd.h, clcd.c, func_list.h, func_list.c in my_files.zip
You could create a hellow_world project and replace main.c and add the rest of files to your project.

moto

 

0 Likes
brabink
Level 1
Level 1
10 likes given 10 sign-ins 5 likes given

Hola, como puedo hacer para importar el codigo en ModusToolbox?

 

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,
Hola,

As I have not used ModusToolbox, I tried with CY8CPROTO-063-BLE, tonight.
There may be better methods, but at least mine also seems working.

Como no he usado ModusToolbox, esta noche probé con CY8CPROTO-063-BLE.
Puede que haya mejores métodos, pero al menos el mío también parece funcionar.

IMG_5866.JPG

First, start the ModusToolbox and select the workspace.
Primero, inicie ModusToolbox y seleccione el espacio de trabajo.

001_selecting_workspace.JPG

The workbench shows up.
Aparece el banco de trabajo.

003-new-project.JPG

Select menu File > New > ModusToolbox Application
(No sé si el menú está en español.)

003-new-project.JPG

Choose a BSP for your board. 
Elija un BSP para su placa.

004-choose_bsp.JPG

This time my board was CY8CPROTO-063-BLE.
Esta vez mi placa fue CY8CPROTO-063-BLE.

005-board_selection.JPG

Then select an appliation type. I chose "Getting Started"
Luego seleccione un tipo de aplicación. Elegí "Comenzar"

006-select-application.JPG

I chose "Hello World" and there we can change the project name,
so I changed it to "Hello_charLCD". (Any Project name should be fine.)

Elegí "Hello World" y ahí podemos cambiar el nombre del proyecto,
así que lo cambié a "Hello_charLCD". (Cualquier nombre de proyecto debería estar bien).

007-name_charLCD.JPG

"Hello_charLCD" project was created.
Se creó el proyecto "Hello_charLCD".

008-project_created.JPG

I unziped the "my_files.zip" uploaded in my previous post.
Descomprimí el "my_files.zip" subido en mi publicación anterior.

009-my_files_folder.JPG

I copied above files into the project folder.
Copié los archivos anteriores en la carpeta del proyecto.

010-copy_my_files.JPG

Then these files are reflected in to the project.
Luego, estos archivos se reflejan en el proyecto.

011-files-appeared.JPG

Then open "clcd.h" and enter defines of CLD_DB7 ~ CLD_DB4, CLCD_E, CLCD_RW, CLCD_RS
for your board. Mine was something like below.
Luego abra "clcd.h" e ingrese las definiciones de CLD_DB7 ~ CLD_DB4, CLCD_E, CLCD_RW, CLCD_RS
para tu tablero. El mío era algo así como a continuación.

 

#include <stdint.h>

#define CLCD_DB7 (P9_6)
#define CLCD_DB6 (P9_5)
#define CLCD_DB5 (P9_4)
#define CLCD_DB4 (P9_3)
#define CLCD_E   (P9_2)
#define CLCD_RW  (P9_1)
#define CLCD_RS  (P9_0)

#define CLCD_GPIO_Write(PIN, value) cyhal_gpio_write(PIN, value)

 

013-clcd_h_defines_added.JPG

Then build the project.
Luego construye el proyecto.

014-build.JPG

After building the project, set up a serious terminal, such as Tera Term for "local echo" 
Después de construir el proyecto, configure una terminal seria, como Tera Term para "eco local".

020-TeraTerm-Term.JPG

Connect the CharLCD as below.
Conecte el CharLCD como se muestra a continuación.

022-connection.JPG

Start the Debugger.
Inicie el depurador.

021-resume.JPG

At first, if everything is going OK, "CLCD Test" is printed in the CLCD.
Al principio, si todo va bien, se imprime "Prueba CLCD" en el CLCD.

Type "help" to show the command list.
Escriba "ayuda" para mostrar la lista de comandos.

023-TeraTerm-log.JPG

Then type "pos 2 1" to move cursor to the next line.
Luego escriba "pos 2 1" para mover el cursor a la siguiente línea.

IMG_5867.JPG

Then type "print hello" to print "hello" there.
Luego escriba "imprimir hola" para imprimir "hola" allí.

IMG_5868.JPG

I hope this can be some hint for you.
Espero que esto pueda servirte de alguna pista.

moto

 

 

 

 

 

 

 

Muchisimas gracias por la respuesta tan rapida! , otra consulta, mi LCD tiene modulo I2C, en ese caso como podria hacerlo funcionar?,  se me complico mucho y aun no logro que funcione

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

otra consulta, mi LCD tiene modulo I2C
> my LCD has an I2C module
lol

I searched "PSoC6 I2C LCD" and found my post...
Busqué "PSoC6 I2C LCD" y encontré mi publicación...

https://community.infineon.com/t5/Code-Examples/I2C-CharLCD-1602-Module-Sample-CY8CKIT-062-BLE/td-p/...

I hope that although it was a PSoC Creator project,  i2c_clcd.h and i2c_cldc.c should be as usable as the ModusToolbox version.
Espero que, aunque fue un proyecto de PSoC Creator, i2c_clcd.h e i2c_cldc.c sean tan utilizables como la versión ModusToolbox.

moto

me podrias hacer una guia como la respuesta anterior por favor? sigo sin poder hacerlo funcionar

0 Likes
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,
Hola,

me podrias hacer una guia como la respuesta anterior por favor? sigo sin poder hacerlo funcionar

Well, well, well, fortunately or unfortunately, it was Saturday today.
So I could spend most of the day fighting with MTB I2C implementation. >_<

Bueno, bueno, bueno, por suerte o por desgracia, hoy era sábado.
Entonces podría pasar la mayor parte del día luchando con la implementación de MTB I2C. >_<

I'm assuming "PCF8574" for the I2C module.
Supongo que "PCF8574" para el módulo I2C.

IMG_5869.JPG

First create a bsp project like the steps below.
Primero cree un proyecto bsp como los pasos a continuación.

001-workspace.JPG

002-WorkBench.JPG

003-New-Project.JPG

004-Choose_BSP.JPG

005-select-CY8CPROTO-063-BLE.JPG

This time I selected "HAL I2C Master" from "Peripherals".
Esta vez seleccioné "HAL I2C Master" de "Periféricos".

006-Template_I2C_HAL_Master.JPG

Now a new project is created.
Ahora se crea un nuevo proyecto.

007-Project_Created.JPG

Then we need to import the following source files and headerfiles from the attached archive file.
Luego necesitamos importar los siguientes archivos fuente y archivos de encabezado desde el archivo adjunto.

i2c_clcd.h, i2c_clcd.c, i2c_utils.h, i2c_utils.c

Then over write main.c with the one in the attached archive file.
Luego, sobrescriba main.c con el que está en el archivo adjunto.

Actually these can be done just copy and past these 5 files into the project folder.
En realidad, esto se puede hacer simplemente copie y pegue estos 5 archivos en la carpeta del proyecto.

Now connect VCC, GND, SCL (P6[4]), SDA (P6[5]) between the I2C Module and the PSoC board.
Ahora conecte VCC, GND, SCL (P6[4]), SDA (P6[5]) entre el módulo I2C y la placa PSoC.

Building and downloading the project will show "Hello" for 2 seconds then start counting.
Al compilar y descargar el proyecto se mostrará "Hola" durante 2 segundos y luego comenzará a contar.

moto

 

 

 

 

Muchisimas Gracias!! 😁

0 Likes
brabink
Level 1
Level 1
10 likes given 10 sign-ins 5 likes given

otra consulta jajaj, vi que tenes publicado proyectos sobre el sensor ultrasonico HC-SRO4, lo tendrias en modus toolbox?

0 Likes