Skip to content

Arduino UNO R4 Minima/WiFi peripheral register monitor though the external serial I/F (Serial1) at D0(RX)/D1(TX).

License

Notifications You must be signed in to change notification settings

embedded-kiddie/PeripheralMonitor

Repository files navigation

PeripheralMonitor

For the purpose of learning the RA4M1, this program monitors peripheral registers through the Arduino Minima/WiFe external serial I/F at D0(RX)/D1(TX).

How to use

  1. Connect to your host PC with Minima/WiFi board via usb serial converter module.

Connection between Arduino UNO R4 Minima/WiFi bord and your host PC

  1. Run the VT100 terminal emulator software such as Tera Term on your Windows PC. The configuration of serial communication protocol parameters such as the data, parity, and stop bits should be same as SERIAL_8N1.

    In case of Mac, please follow the instructions below:
  • Run the Termina.app
  • Type ls -l /dev/tty.* to find the USB serial device file.
  • Type screen /dev/tty.usbserialxxxxx 230400, where /dev/tty.usbserialxxxxx is the name of your USB serial device file and, 230400 is baud rate.
  • To quit the screen command, type CTRL-a + k.
  • To reset your Terminal.app, type reset.
  1. Download the latest version of this program from latest release, and install it from SketchInclude LibraryAdd .ZIP Library… on Arduino IDE.

  2. Open the example sketch from FileExamplesPeripheralMonitormonitor_by_rtc in Examples from Custom Libraries.

  3. Click Upload button to compile, upload and execute the program.

Screens

You can see the following five screens through the terminal emulator on your host PC.

  • PORTS
    Port Control register from PORT1 to PORT4
    PORTS
  • PORT n
    Port Control register of PORT n where n is 0 to 9, such as PORT1 PORT1
  • P mn
    Port Function Select register of P mn where m is 0 to 9 and n is 00 to 15, such as P102 P102
  • PINS
    Port Function Select register from D0 to D19 of Arduino pins PINS
  • AGT n Asynchronous General-Purpose Timer register of AGT n where n is 0 or 1, such as AGT0 AGT0
  • CTSU
    Capacitive Touch Sensing Unit registers CTSU

Public methods in PeripheralMonitor class

begin

bool begin(int baud_rate, PeripheralType_t type = PERIPHERAL_PORTS, int arg = 0)

This method initializes the Serial1 object and sets the initial screen.

  • int baud_rate
    It must match the settings in the terminal emulator.
  • PeripheralType_t type
    To set the initial screen, specify one of the following enumeration numbers:
/*----------------------------------------------------------------------
 * Peripheral types
 *----------------------------------------------------------------------*/
typedef enum {
  PERIPHERAL_PORTS, // PORT0 〜 PORT9 (default)
  PERIPHERAL_PORT,  // PORT0 〜 PORT9
  PERIPHERAL_PFS,   // PmnPFS (P000 〜 P915)
  PERIPHERAL_PINS,  // D0 〜 D19 (A0 〜 A5)
  PERIPHERAL_AGT,   // AGT0 〜 AGT1
  PERIPHERAL_CTSU,  // CTSU
} PeripheralType_t;
  • int arg
    Specify a numerical value according to PeripheralType_t.

setup_register

void setup_register(PeripheralType_t type = PERIPHERAL_PORTS, int arg = 0)

This method, like the method begin, changes the type of a peripheral.

show_caption

void show_caption(void)

This method sends to the table caption to your host PC.

show_register

void show_register(void)

This method dump the registers into your host PC.

scan_command

void scan_command(void)

This method accepts your commands from Arduino IDE Serial Monitor.

You can type ? or help into the Serial Monitor to see the following result:

Possible commands: ports, port, pins, p, agt, a, d, ctsu, ?, help

For example, you can type such as port1, p102, agt0, a0 and d13.

When you type only return key without any commands, show_caption method is executed.

Sample sketch

See monitor_by_rtc.ino using RTC for periodic monitoring in the examples directory.

Blog post

About

Arduino UNO R4 Minima/WiFi peripheral register monitor though the external serial I/F (Serial1) at D0(RX)/D1(TX).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages