top of page

Blog Post

Technical notes, design insights, and application-oriented engineering.

PP504F1A-02W40 UART Communication in 3 Steps

  • Writer: Lentark Electronics
    Lentark Electronics
  • Nov 28, 2019
  • 3 min read

Updated: 6 days ago

PP504F1A-02W40 PWM-Core module connected to Arduino for UART communication and PWM configuration.

PP504F1A-02W40 is a member of the PWM-Core family designed for configurable PWM signal generation. Compared with simpler PWM signal sources, it provides a more flexible structure for applications that require multiple PWM outputs, adjustable timing parameters and communication-based configuration.


Comparison between PP504F1A-02W40 and PP504F0A-02W30

 

The device can be configured through UART commands. This makes it possible to update PWM parameters such as period, phase and duty cycle from an external microcontroller, including commonly used development boards such as Arduino.

 

In this short application note, we will look at the basic communication process in three simple steps.


The example code used in this note can be found in the PP504F1A-02W40 technical document, under the “Quick Examples of Communication Rules” section.

 

PP504F1A-02W40 UART Communication Overview

PP504F1A-02W40 UART communication is based on sending formatted command strings to the Rx pin of the module. These commands define the PWM channel, the parameter type, the parameter value and the command ending character.

 

The general idea is simple: the external controller sends the required configuration commands, and the PWM-Core applies or stores these values according to the command format.

 

This structure allows the user to configure only the parameters needed for the application. It is not always necessary to update all channels or all parameters at the same time.

 

Step 1: Upload the Example Code to Arduino

The first step is to find the example Arduino code provided in the PP504F1A-02W40 technical document. The coding example is included in the “Quick Examples of Communication Rules” section of the datasheet, together with sample command outputs.


After reviewing the example code, it can be uploaded to the Arduino board that will send configuration commands to the PWM-Core module.


In the example structure, Arduino communicates with the PP504F1A-02W40 through a software serial interface. One pin is used for receiving status information from the module, and another pin is used to transmit UART commands.

 

A typical command output may look like this:

1M20.00<
2M20.00*
3M40.00*
4M40.00*
1P0.00*
2P90.00*
3P180.00*
4P270.00*
1D47.50*
2D47.50*
3D47.00*
4D47.50>

Each command has a clear meaning.

 

For example:

 

1M20.00

sets the period of channel 1 to 20.00 milliseconds.

 

2P90.00

sets the phase angle of channel 2 to 90.00 degrees.

 

4D47.50

sets the duty cycle of channel 4 to 47.50%.

 

The first character defines the PWM channel. The following letter defines the parameter type. The numeric value defines the parameter value.

 

Common parameter letters include:

S: period in seconds

M: period in milliseconds

U: period in microseconds

P: phase angle

D: duty cycle

 

Step 2: Make the UART Connection

After uploading the code, the next step is to connect Arduino and the PP504F1A-02W40 correctly.


Arduino PP504F1A-02W40 connection diagram

 

The basic communication connection is made through the UART pins. The transmit pin of the Arduino side is connected to the Rx pin of the PWM-Core module. The ready or status signal can also be connected if the application needs to check whether the PWM-Core is ready to receive a new command.

 

A common ground connection must also be provided between the Arduino and the PWM-Core module. Without a shared reference, UART communication may not operate reliably.

 

At this stage, the supply voltage and signal connections should be checked carefully before powering the circuit.

 

Step 3: Reset Arduino and Send the Configuration

After the code is uploaded and the wiring is completed, the configuration can be sent by resetting the Arduino.

 

When Arduino restarts, it sends the defined command sequence to the PP504F1A-02W40. The PWM-Core receives these UART commands and updates the PWM output configuration according to the transmitted values.

 

This makes the first communication test very simple. Once the command structure is understood, the user can modify the example values and send different period, phase or duty cycle settings.

 

Sending Only the Required Parameters

One important point is that all PWM parameters do not have to be sent every time. If the application only requires a duty cycle update on one channel, only that command can be sent.

 

For example, a single duty cycle command can be enough when only one output needs to be changed.

 

This makes the communication structure practical for development and testing. The user can start with a complete configuration and later update only the parameters that need to change.

 

Internal Memory Support

PP504F1A-02W40 can store the configured values in its internal memory. This means the module does not need to be fully reconfigured after every restart if the required values have already been stored.

 

This feature is useful in repeated tests and embedded applications where the same PWM configuration must be preserved after power cycling.

 

Conclusion

PP504F1A-02W40 UART communication provides a practical way to configure multiple PWM outputs from an external microcontroller. With a simple command format, the user can define period, phase and duty cycle values for each channel.

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page