0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

STM32G031J6M6とmbrd-os 6でタイミング系を使うと落ちるのでちょつとだけ頑張ったレス

Last updated at Posted at 2022-08-12

目的
なんか気持ち悪い
進捗か止まっていたのは、タイミング系のせい?
なんか頑張ってみる
今のところ原因不明で継続テーマ

image.png


        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


o_con655.jpg

タイマーだとタイミングを取れそう
翻訳では、騒がしいタイマーと言ってあまり良くないらしい
割り込み系のタイマーを頑張ってみよう


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);
    }
}




0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?