I2C test - A simple program for beginners using Modus Toolbox2.1 with PSoC6(M4)

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

cross mob
Kenshow
Level 8
Level 8
Distributor - Marubun (Japan)
50 solutions authored 25 solutions authored 10 solutions authored

Hi all,

I am making some programs for beginners using Modus ToolBox 2.1. When migrating the development environment from PSoc Creator to Modus, I had a hard time creating a simple program. Especially, there are few simple samples using the Device Configuration tool.

Here, a simple program for the M4 core of PSoC 6 using the Device Configuration tool of Modus Toolbox2.1 is introduced here.

The environment is as follows.

ModusToolbox2.1

CY8CKIT-062-BLE

This time it's a simple thing to test I2C of Kit. This test check with I2C that the E-Ink Shield is mounted on your CY8CKIT-062-BLE. The connection destination is scanned with I2C, and 4 bytes data from address 0 is displayed at the I2C address detected by the scan. This program is based on I2C part of Motoo-san’s program, and modified using Device Configration tool.

Select the CY8CKIT-062-BLE kit from the New Application tool in the Quick Panel and use it based on what was created in the empty PSoC 6 app.

About the pin setting, start the Device Configuration tool from the Quick Panel in the IDE of Modus Toolbox2.1, and set it according to the following procedure.

1.png

Go to “Peripheral” tab and set Serial Communication Block (SCB) 3 as I2C.

On the right side of the Peripheral tab, there is a place to set the I2C parameters. Set the Mode and Data Rate.

 Mode:Master

 Data Rate:100

Select the input clock source from the pull-down menu.

 Clock Signal:16bit Divider 1 clk

Add the retarget-io library from Library Manager to display in UART output. The method is introduced in "UART to output with printf() function-A simple program for beginners using Modus Toolbox2.1 with PSo...".

Build is successful and execute this program, UART message is as follows.

1.jpg

I tried to make the program as simple as possible, but there were various points to control and check, and it became a little complicated. See the attached program for details.

Thanks,

Kenshow

1 Reply
SampathS_11
Moderator
Moderator
Moderator
250 sign-ins 250 solutions authored 5 questions asked

Hello Kenshow,

Thank you very much for sharing your code example for beginners in the community.

Best regards,

Sampath Selvaraj