Git Product home page Git Product logo

Comments (9)

BoMadsen avatar BoMadsen commented on August 25, 2024 1

Firstly I tried the 1.2.0 from platformio, and I was unable to get it to work on the Teensy 4.1. But after I pulled the library directly from here, it worked like a charm. So it looks like the fix is working 👍

from chrt.

greiman avatar greiman commented on August 25, 2024

Support for Teensy 4.0 requires mods to other files since it is a Cortex M7 processor. The mods are to files in various folders.

I am not sure when I will tackle Teensy 4.0 since I would start with the latest version of ChibiOS so I have the latest Cortex M7F support in CMSIS.

from chrt.

greiman avatar greiman commented on August 25, 2024

I have been looking at the latest ChibiOS 19.3. It really looks good.

I wish I could port it in tickless mode to Arduino style boards. This allows better time resolution with no overhead unless you use a feature.

from chrt.

bk4nt avatar bk4nt commented on August 25, 2024

The point is the Arduino IDE, libs, and the accessibility. Other would say move away to another IDE and use ChibiOS source code, but that would mean much more difficulties to get things running on an Arduino or a Teensy (the Teensy 4.0 introducing nice new features, like digital audio).

Thanks for your efforts.

from chrt.

greiman avatar greiman commented on August 25, 2024

Try the new release. It has Teensy 4.0 support with both periodic and tick-less modes.

http://www.chibios.org/dokuwiki/doku.php?id=chibios:articles:tickless

The Teensy 4.0 GPT timer exactly matches the requirement for tick-less mode. Most timer functions are a single line of code.

Here is the ChibiOS GPT2 functions. I couldn't believe how simple they are.

/**
 * @brief   Returns the time counter value.
 *
 * @return              The counter value.
 *
 * @notapi
 */
static inline systime_t st_lld_get_counter(void) {
  return (systime_t)GPT2_CNT;
}

/**
 * @brief   Starts the alarm.
 * @note    Makes sure that no spurious alarms are triggered after
 *          this call.
 *
 * @param[in] time      the time to be set for the first alarm
 *
 * @notapi
 */
static inline void st_lld_start_alarm(systime_t time) {
  GPT2_OCR1 = (uint32_t)time;
  GPT2_SR |= GPT_SR_OF1; 
  GPT2_IR = GPT_IR_OF1IE;
}

/**
 * @brief   Stops the alarm interrupt.
 *
 * @notapi
 */
static inline void st_lld_stop_alarm(void) {
  GPT2_IR = 0;
}

/**
 * @brief   Sets the alarm time.
 *
 * @param[in] time      the time to be set for the next alarm
 *
 * @notapi
 */
static inline void st_lld_set_alarm(systime_t time) {
  GPT2_OCR1 = (uint32_t)time;
}

/**
 * @brief   Returns the current alarm time.
 *
 * @return              The currently set alarm time.
 *
 * @notapi
 */
static inline systime_t st_lld_get_alarm(void) {
  return (systime_t)GPT2_OCR1;
}

/**
 * @brief   Determines if the alarm is active.
 *
 * @return              The alarm status.
 * @retval false        if the alarm is not active.
 * @retval true         is the alarm is active
 *
 * @notapi
 */
static inline bool st_lld_is_alarm_active(void) {
  return (GPT2_IR & GPT_SR_OF1) != 0;
}

from chrt.

boikonur avatar boikonur commented on August 25, 2024

Hi @greiman It seems that latest Teensiduino doesn't work with your lib. I thought its because something in the GPT2 Timer configuration is now off. But I cant seem to make the periodic work as well.

from chrt.

greiman avatar greiman commented on August 25, 2024

Looks like a conflict that causes a lockup. I will look at it more when I have time.

from chrt.

greiman avatar greiman commented on August 25, 2024

Try the latest update. I think I found the problem.

Paul added a 32 byte protected region between bss and the stack. I fill the stack with 0X55 and the new region caused a memory protection fault.

I set stack low address to &_ebss + 32. Hope Paul doesn't change that since there is no symbol for stack low address.

The stack overflow region is a great idea, worth breaking ChRt.

from chrt.

Rainerino avatar Rainerino commented on August 25, 2024

I have tried the same thing as @BoMadsen suggested, and it fixed the problem. It seems that platformio build is not working, but direct pull from this repo works.

By the way, Thank you very much @greiman for this amazing library!

from chrt.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.