DHCOR STM32MP1 Linux: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Mholzner (talk | contribs)
Mholzner (talk | contribs)
Line 35: Line 35:




 
== Kernel Userspace Interfaces to Access Hardware ==
 
=== Serial (UART) Interfaces ===
:'''Unsing the internal RTC'''
:{| class="wikitable" style="width: 400px"
:At first the time needs to be set:
  ||DHCOM (FF) UART 1||<tt>/dev/ttymxc0</tt>
:{| class="wikitable" style="width: 500px"
|-
  ||Display current time||''# date''</tt>
||DHCOM (BT) UART 2 ||<tt>/dev/ttymxc4</tt>
  |-
  |-
  ||Change time ||''# date -s "2020-01-30 10:00:00"''</tt>
  ||DHCOM (STD) UART 3 ||<tt>/dev/ttymxc3</tt>
  |}
  |}


:Next save the current time to the internal RTC:
:{| class="wikitable" style="width: 500px"
||Save the current time to the hardware clock||''# hwclock -w''
|}


=== RS-485 on picoITX ===
:Set a specific system time
:'''RS-485 device'''
:{| class="wikitable" align="center" |  style="color: #000000; background: #FFFFFF;" valign="top" |
:{| class="wikitable" style="width: 400px"
|<tt>''# date -s "2020-01-30 10:00:00"</tt>
||DHCOM UART 2||<tt>/dev/ttySTM2</tt>
  |}
 
:'''Compilation on target'''
:{| class="wikitable"
|<tt>''gcc tty_rs485_test.c -o tty_rs485_test''</tt>
|}
|}


:'''Set tty device to raw mode'''
:Save the current system time to the RTC of the STM32MP1
:{| class="wikitable"
:{| class="wikitable" align="center" |  style="color: #000000; background: #FFFFFF;" valign="top" |
|<tt>''stty -F /dev/ttySTM2 115200 cs8 raw -echo''</tt>
|<tt>''# hwclock -w</tt>
|}
|}


:'''Send data with demo program'''
:When you allready have stored a date on the RTC and you want to read it out, use the next command. This command only gives back the time, but does not synchronize it with the system time. This is done in the next step.
:{| class="wikitable"
:{| class="wikitable" align="center" |  style="color: #000000; background: #FFFFFF;" valign="top" |
|<tt>''echo -n -e "\n\rHallo RS485 Welt!" | ./tty_rs485_test /dev/ttySTM2''</tt>
|<tt>''# hwclock -r</tt>
|}
|}


:'''Receive data with demo program'''
:The system time can be synchronised to the RTC by this command:
:{| class="wikitable"
:{| class="wikitable" align="center" |  style="color: #000000; background: #FFFFFF;" valign="top" |
|<tt>''./tty_rs485_test /dev/ttySTM2''</tt>
|<tt>''# ??????????????????</tt>
|}
|}
:'''Download example source code'''
:* [[media:Tty_rs485_test.zip | tty_rs485_test.c]]

Revision as of 09:20, 22 July 2020

PAGE IS UNDER CONSTRUCTION!

Linux Userspace Commands

Unsing the internal RTC

Read out the current date
# date
Set a specific system time
# date -s "2020-01-30 10:00:00"
Save the current system time to the RTC of the STM32MP1
# hwclock -w
When you allready have stored a date on the RTC and you want to read it out, use the next command. This command only gives back the time, but does not synchronize it with the system time. This is done in the next step.
# hwclock -r
The system time can be synchronised to the RTC by this command:
# ??????????????????




Kernel Userspace Interfaces to Access Hardware

Serial (UART) Interfaces

DHCOM (FF) UART 1 /dev/ttymxc0
DHCOM (BT) UART 2 /dev/ttymxc4
DHCOM (STD) UART 3 /dev/ttymxc3


Set a specific system time
# date -s "2020-01-30 10:00:00"
Save the current system time to the RTC of the STM32MP1
# hwclock -w
When you allready have stored a date on the RTC and you want to read it out, use the next command. This command only gives back the time, but does not synchronize it with the system time. This is done in the next step.
# hwclock -r
The system time can be synchronised to the RTC by this command:
# ??????????????????