Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 19 of 19

Thread: Can ARM peripherals be accessed in the Teensy family?

  1. #1

    Can ARM peripherals be accessed in the Teensy family?

    Moving up from Arduino - have been LONG time fan of the ARM world. Now digging into the HAL functions for an STM32 board/chip. Have also been BLOWN AWAY by the specs of the Teensy 4.0! Have no use other than to just "have one that fast" and to tinker with it. With my ongoing exploration of the ARM/HAL world wondering if I can access the peripherals on the processor.

    =Alan R.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,752
    By "access the peripherals", are you asking for a HAL similar to STM32? Or the ability to directly use the hardware registers, writing your own code to manipulate the peripheral.

    Generally speaking, the "HAL" we have is Arduino's APIs and libraries which mostly follow Arduino's conventions, not the same style as ST publishes. Of course you can also directly access the hardware, if you really want.

    This pretty general answer is the best I can do for such a non-specific question. If there's something in particular you want, maybe give more context & explanation. We're pretty good at helping on this forum when you give us more info about what you really want to accomplish.

  3. #3
    Thanks for the quick reply Paul. Just learning all the ARM buzz words so sorry if a bit vague. I’ve done a fair amount of Arduino work, and want to move into ARM. I have been reading the HAL library docs provided by ST for my Nucleo board.

    Once I get a handle on programming I’d like to use something small like a Teensy on a solder board. Most of the Arduino projects ive done us a Pro Mini, Nano or Micro board. So I’m thinking the Teensy boards would be my replacement board, and hoping what I learn with the Nucleo board and HAL functions will serve me on the Teensys. Nothing spectacular- would just to make use of the on board peripherals like GPIO, UART, DMA... etc.

    A.

  4. #4
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    677
    I think the quick answer is, you can do anything the hardware can do. There are a few choices: you can use any of various existing Arduino type libraries, which make interfacing pretty easy, or you can control registers directly. For example I wanted to use a 32-bit timer with a 150 MHz clock rate on the Teensy 4, which was just released and there is not yet a timing library written for T4 using that specific mode. However it is still possible to do it, as the code examples in this thread show: https://forum.pjrc.com/threads/57276...l=1#post213016

    With any piece of computer hardware, I find that how useful it is to me depends on 1) the hardware itself and 2) the support and user community which can either help you use and understand these very complicated machines... or not. In my opinion, Teensy hardware is great AND Paul does excellent work on the core code and libraries AND there is also a great user community here on the forum. Just my $0.02 of course :-)

  5. #5
    Quote Originally Posted by JBeale View Post
    I think the quick answer is, you can do anything the hardware can do. There are a few choices: you can use any of various existing Arduino type libraries, which make interfacing pretty easy, or you can control registers directly. For example I wanted to use a 32-bit timer with a 150 MHz clock rate on the Teensy 4, which was just released and there is not yet a timing library written for T4 using that specific mode. However it is still possible to do it, as the code examples in this thread show: https://forum.pjrc.com/threads/57276...l=1#post213016

    With any piece of computer hardware, I find that how useful it is to me depends on 1) the hardware itself and 2) the support and user community which can either help you use and understand these very complicated machines... or not. In my opinion, Teensy hardware is great AND Paul does excellent work on the core code and libraries AND there is also a great user community here on the forum. Just my $0.02 of course :-)
    ------------------------------------
    It wasn't so much that I was questioning the capabilities of the hardware - I'm just now getting familiar with the Teensy products and wasn't sure how one interacts with the devices. I'd like to treat the MCU as an ARM/Cortex device and use the HAL functions to access the peripherals. And I'm DEF not interested in writing my own drivers... ARRGH!

    From what I've learned so far - the basic PRJC approach is to treat the Teensy as a SMART/FAST Arduino. I've installed TeensyDuino and the Arduino IDE shows it just fine. I've been digging into the ARM/ST software and libraries and suspect what I might have to do is install a different boot loader to get the board/chip to be recognized as Cortex ARM7. Doing lots of stumbling around here - so at this point I probably know just enough to be dangerous! LOL!

  6. #6
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,356
    Quote Originally Posted by alan856 View Post
    From what I've learned so far - the basic PRJC approach is to treat the Teensy as a SMART/FAST Arduino. I've installed TeensyDuino and the Arduino IDE shows it just fine. I've been digging into the ARM/ST software and libraries and suspect what I might have to do is install a different boot loader to get the board/chip to be recognized as Cortex ARM7. Doing lots of stumbling around here - so at this point I probably know just enough to be dangerous! LOL!
    Note, Teensy uses a separate chip for the bootloader.

  7. #7
    Quote Originally Posted by MichaelMeissner View Post
    Note, Teensy uses a separate chip for the bootloader.
    Yikes! Is it accessible to put in other software? All new to me! :-(

  8. #8
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,356
    Quote Originally Posted by alan856 View Post
    Yikes! Is it accessible to put in other software? All new to me! :-(
    Well you can download any program into the Teensy 4.0. You don't have to use the Arduino IDE, as long as you build a program that the downloader recognized. However, you can't change the actual bootloader that is on a separate chip (without a lot of work). That means you can only download programs via USB by default. In older chips, people talked about alternate ways of loading Teensys. Mostly the discussion tended to peter out, but it is possible people came up with solutions.

    In those older chips, you could buy the chip separately and design your own Teensy clone, using the bootloader that PJRC sells to do this. This was often used by people prototyping on Teensy, and then making their board for products. At the moment, because the Teensy 4.0 is so new, PJRC hasn't offered a bootloading chip for the 4.0. I suspect they will, but right now Paul likely has so many other things in flight that needs doing.

    What is it you are trying to do exactly? Maybe your needs don't mesh with Teensy 4.0, maybe you just need to think of ways to do things in the Teensy fashion.

  9. #9
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    677
    I gather you want to use someone else's libraries, not Teensy/Arduino. The main selling point of the Teensy boards is (for me) that they're easy to use because of Arduino-style libraries. The PJRC separate bootloader, along with the Teensy core and libraries is the defining feature of a Teensy from my perspective. The bootloader cannot be replaced AFAIK (short of tearing that chip off the board and connecting to the JTAG lines yourself). However at the lowest level, you're still simply using GCC to compile ARM code for the specific device, and as far as I know you can ask the Teensy bootloader to load in whatever ARM code you may have come up with on your own, using whatever software libraries you may prefer, of course you'd be on your own as far as all the details for the specific chip. Not all ARM devices are alike needless to say.

    Below articles are specific to Teensy 3.1 but you may find them of interest as "bare metal" / non-Arduino use:
    https://disconnected.systems/blog/ba...he-teensy-3.1/
    http://kevincuzner.com/2014/12/12/te...-a-usb-driver/
    https://www.seanet.com/~karllunt/bareteensy31.html

  10. #10
    Heh - just trying to tinker and learn the mysteries of the ARM/Cortex world. These chips are SO powerful - just wanted to 'jump in' and see what could be done. I do access the various boards I have with USB - just not sure how one would build a program another IDE. I have MS Visual Studio (with Visual Micro for Arduino), Visual Studio Code and made an attempt to get Visual Teensy working but didn't quite get that going yet. I've gotten fairly comfortable with Arduino by studying the Atmel 328 datasheet - was a struggle of it's own but got there! So was thinking I could do the same with ARM. But - Horse of a VERY different color!

    I've been STRUGGLING with the IDE supplied by ST (STM32CubeIDE) (must be 3 or 4 different versions). Once I can use the resources of the ARM's I'll find useful things to do! :-)

  11. #11
    Ok - not trying to dis the Teensy community or boards! Have had a 3.2 board here for some time and haven't gotten my 'round-too-it' to check it out until now. I don't have any prob with using the Arduino interface - but where do you learn about what functions to use? The vanilla Arduino IDE followed the 328 datasheet and you could find out how things worked from that. So is there some other docs for Teensy the shows the various peripherals/registers and how to use them?

  12. #12
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    677
    The manufacturer's datasheet and programming manuals for the various chips used in the different Teensy versions are here:
    https://www.pjrc.com/teensy/datasheets.html

    There is a lot of detail and it can be a tough slog. The Teensy 4 (i.MX RT1060) manual is something like 3600 pages. I tend to use the existing libraries as much as possible, to avoid having to dip into those references.

  13. #13

    Exclamation

    Quote Originally Posted by JBeale View Post
    The manufacturer's datasheet and programming manuals for the various chips used in the different Teensy versions are here:
    https://www.pjrc.com/teensy/datasheets.html
    Yikes - Just grabbed the datasheet for the T4 processor - 3367 pages!!! And I thought the '328 was big a over 1100.... I feel a bit like the dog that chased the car - now that I caught it - don't know what to do with it... Guess I'll have something to keep me busy for a while...

  14. #14
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,689
    I know Paul has said it more than once. That the programing manuals don't give you a lot of the information to really understand what is going on.

    So if you again look at the datasheet page he recommends the book: https://www.amazon.com/dp/0124080820
    Not sure if there is another one for the M7...

  15. #15
    Ah yes - do have that book as a PDF. I think it only covers M3/M4 but the principles should hold up... but then again that T4 has such a bear of a system... dunno if that is going be that easy. ��

  16. #16
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,752
    Quote Originally Posted by alan856 View Post
    I don't have any prob with using the Arduino interface - but where do you learn about what functions to use?
    You could go to Arduino's reference page and read what every function does. Likewise for their libraries page, and the many libraries pages at PJRC. You could study the ~4000 pages of NXP's documentation, and Joseph Yiu's book, and the documentation ARM publishes.

    Or you could ask us a more specific question. Without understanding what you want to do, the best anyone here can do is point you to this mountainous pile of documentation. But if you explain, if you give us some context to understand what you want to accomplish, odds are pretty good we could help you find the right info, maybe even offer some advice as well. Without knowing anything specific about your needs, the best anyone can do is just point you to *all* the documentation.

  17. #17
    I hear ya Paul! But I’m not trying to do any specific project at this point- just interested in how one uses the HAL libraries with the ARM chips. I don’t mind rooting thru those docs. - have a number of them printed out in 3-ring binders (but NOT the monster 3.3k pages of the RT1060!). I think I have found some useful stuff in the Cortex M3/M4 book - but he stops a bit short as the book really isn’t about coding.

    Once I get that T4 in hand and start messing with it I’m sure I’ll be able to take advantage of the resources of this forum. I think I’ll just leave the Teensy’s as they are... which is super!

    I understand that Accelstepper has a square root function in it. Wonder if the math processor in the T4 chip would get rid of the delay it causes in Arduino boards... I should think so!

    This forum was not the place to ask what I did. I didn’t really know major points of the Teensy concepts... but sm learning.

  18. #18
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,689
    I guess for me, and maybe a some others, I have no idea what you mean by:
    just interested in how one uses the HAL libraries with the ARM chips.
    What HAL (Hardware Abstraction Layer) libraries?

    Yes I know there some CHIP manufactures may define some form of HAL library to use with their chips. And I know that there are some Arduino builds for some chips that may include these as part of their Arduino implementation. For example I know Robotis uses some of the setup including some portions of HAL when they built and released their versions of Arduino for their OpenCM and OpenCR boards.

    Some others may choose to have their core files and libraries talk directly to the underlying hardware, without trying to defines some intermediary layer between them. Teensy is more in this camp.

    both approaches have their pluses and minuses. For example using some Abstraction layer like some form of HAL, that he chip manufacturer has developed, might allow you to be able to adapt to some new version of a chip, as they probably will release a new version of their HAL that enables the new chip. However the downside, is this often introduces overhead (sometimes a lot), both with memory size as well as speed. Which is always an interesting trade off.

    As Paul mentioned, for many of us, it is much easier for us to try to answer things when there are more specific questions.

    The Teensy forums are a great place to ask questions. There are lots of us who try to help out as we can. But as Paul mentioned, it is a lot easier to help out, when we have a clue of what information you are actually interested in.

    The new T4 is a lot of fun!

  19. #19
    Ok. As I said- guess I brought my question to the wrong forum. I had no real idea how the Teensy was set up to make life a bit easier vis the Arduino IDE. I’m sure that will be a great help as I tackle the T4.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •