目的
なんか気持ち悪い
進捗か止まっていたのは、タイミング系のせい?
なんか頑張ってみる
今のところ原因不明で継続テーマ
ThisThread::sleep_for(5s);
で
++ MbedOS Error Info ++
Error Status: 0x80FF0100 Code: 256 Module: 255
Error Message: Fatal Run-time error
Location: 0x8003349
Error Value: 0x0
For more info, visit: https://mbed.com/s/error?error=0x80FF0100&tgt=NUCLEO_G031K8
-- MbedOS Error Info --
HAL_RCC_OscConfig ERROR
time_t seconds = time(NULL) + (60 * 60 * 9); // JST
で
++ MbedOS Error Info ++
Error Status: 0x80FF0100 Code: 256 Module: 255
Error Message: Fatal Run-time error
Location: 0x8003C51
Error Value: 0x0
For more info, visit: https://mbed.com/s/error?error=0x80FF0100&tgt=NUCLEO_G031K8
-- MbedOS Error Info --
Cannot initialize RTC with LSE
Timer t;
int main()
{
省略
t.start();
int ii;
while(1) {
auto s = chrono::duration_cast<chrono::seconds>(t.elapsed_time()).count();
sprintf( buf, "%llu\r\n", s );
ii=0;
while(buf[ii] != 0) {
HAL_UART_Transmit(&hlpuart1, (uint8_t *)&buf[ii], 1, 10);
ii++;
} //while
} //main
で
タイマーだとタイミングを取れそう
翻訳では、騒がしいタイマーと言ってあまり良くないらしい
割り込み系のタイマーを頑張ってみよう
stm767ziを使うと上手く動く
/* mbed Microcontroller Library
* Copyright (c) 2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*/
#include "mbed.h"
#define WAIT_TIME_MS 500
DigitalOut led1(LED1);
int main()
{
printf("This is the bare metal blinky example running on Mbed OS %d.%d.%d.\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
while (true)
{
led1 = !led1;
thread_sleep_for(WAIT_TIME_MS);
}
}
/* mbed Microcontroller Library
* Copyright (c) 2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*/
#include "mbed.h"
// Blinking rate in milliseconds
#define BLINKING_RATE 500ms
int main()
{
// Initialise the digital pin LED1 as an output
DigitalOut led(LED1);
while (true) {
led = !led;
ThisThread::sleep_for(BLINKING_RATE);
}
}
/* mbed Microcontroller Library
* Copyright (c) 2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*/
#include "mbed.h"
#include "platform/mbed_thread.h"
// Blinking rate in milliseconds
#define BLINKING_RATE_MS 170
int main()
{
// Initialise the digital pin LED1 as an output
DigitalOut led(LED1);
while (true) {
led = !led;
thread_sleep_for(BLINKING_RATE_MS);
}
}