Raspberry Pi 2, get system clock with timeval

版本 1.0.0.0 (159.4 KB) 作者: Marc Compere
This Simulink model has an S-function builder block to access the linux system time via gettimeofday
358.0 次下载
更新时间 2015/12/16

查看许可证

------------------------------------------------------------------------------------------------
This model uses Raspberry Pi library block to toggle the LED and a executes custom written S-function to access the targeted system time for comparison
to the running simulation time. This is helpful in quantifying soft-real-time performance.

The POSIX gettimeofday() function has resolution down to microseconds but windows and linux have good resolution to around
10ms and about 1ms, respecctively, depending.

The S-function builder auto-generates a .tlc file and generates a fully-inlined S-function that is helpful in targeting the Raspberry Pi device
(or any other Simulink Coder target).

getSystemClockTimeval.c works on the host PC and also the Raspberry Pi runnning Debian Wheezy linux. The simulink code computes the differnce between
the operating system's local time and the simulation time then logs that to a file. The write-to-file block works on the host or the targeted Raspberry Pi.

------------------------------------------------------------------------------------------------
This Simulink model was tested and runs on R2015b on Windows 10 with the gcc MinGW 64-bit compiler.

To run this model on a PC with Matlab, double click the light blue initiailzation block to specify h_fixed=0.1 seconds, then open the s-function builder block, hit build, and upon successfully creating the s-function getSystemClockTimeval.c and associated .tlc file it will build getSystemClockTimeval.mexw64. You can then run the simulation on the host PC. It logs a matfile called myTestData.mat in the working directory.

To run this file on the Rasperry Pi 2 model B, double click the initialization block to assign h_fixed=0.1 seconds, then open the S-function builder, build the s-function and associated .tlc file, then close that dialogue box. Press ctrl-B to build and target the model to your properly configured Raspberry Pi 2 device.

------------------------------------------------------------------------------------------------
Marc Compere, comperem@erau.edu
created : 16 December 2015
modified: 16 December 2015

引用格式

Marc Compere (2024). Raspberry Pi 2, get system clock with timeval (https://www.mathworks.com/matlabcentral/fileexchange/54546-raspberry-pi-2-get-system-clock-with-timeval), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2015b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Simulink Supported Hardware 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0