Difference between revisions of "Microcontrollers"

From Wiki at Neela Nurseries
Jump to: navigation, search
m (^ Sparkfun Thing Plus example code and tools: adding note on newtmgr profile configuration command.)
m (^ Microprocessors: add link to gcc toolchain ARC processor families support.)
 
(33 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
2021-07-09 Friday
 
2021-07-09 Friday
  
Notes On Microcontrollers
+
Notes On Microcontrollers And Processors
 
</center>
 
</center>
  
 +
<span id="nn_keywords_template"></span>
 +
{|
 +
|-
 +
|<font color="grey">- neela nurseries keywords template here -</font>
 +
|-
 +
|Keywords:  <code>two builds</code> <code>[[#anchor_local_page_west_build_commands|west build commands]]</code> <code>newtmgr</code>
 +
|}
  
Keywords:  <code>two builds</code>
 
  
 
== [[#top|^]] Overview ==
 
== [[#top|^]] Overview ==
This local wiki page a starting point for general notes on microcontrollers cerca 2020.
+
 
<!-- comment -->
+
This local wiki page a starting point for general notes on microcontrollers cerca 2020. This local neela wiki article uses the abbreviation "MCU" to mean microcontroller.  A few particular MCU families have their own notes pages on this wiki.  As of 2022 Q3 these MCU families include:
 +
 
 +
&nbsp;<br />
 +
<ul><!-- se que el tag de 'ul' no es la manera corecta para endentar -->
 +
*  [[Microcontrollers-nordic]]
 +
*  [[Microcontrollers-st]]
 +
*  [[Microcontrollers-nxp]] <i>( note NXP now merged with Freescale )</i>
 +
*  [[Microcontrollers-cypress]]
 +
*  [[Microcontrollers-texas-instruments]]
 +
</ul>
 +
 
 +
This local page includes [[#nn_anchor_processors|notes on microprocessors]], also referred to as "processors".
 +
 
 +
<!-- comentario -->
 +
 
 +
== [[#top|^]] Electrical Matters in MCUs ==
 +
 
 +
*  https://embeddedartistry.com/blog/2018/06/04/demystifying-microcontroller-gpio-settings/
 +
 
 +
<!-- comentario -->
 +
 
 +
== [[#top|^]] MCU Families Early and Middle 2020s ==
 +
 
 +
<i>stub section</i>
 +
 
 +
<!-- comentario -->
 +
 
 +
== [[#top|^]] ARM microcontrollers ==
 +
 
 +
Here information and links regarding low power modes in ARM Cortex M0, M4 and M33 family microcontrollers . . .
 +
 
 +
<ul>
 +
*  https://developer.arm.com/documentation/100235/0003/the-cortex-m33-processor/power-management
 +
</ul>
 +
 
 +
Useful article on how to debug hardfaults on many ARM microcontrollers, and notes on special registers to read for this debugging purpose:
 +
 
 +
<ul>
 +
*  https://interrupt.memfault.com/blog/cortex-m-hardfault-debug
 +
</ul>
 +
 
 +
Main stack pointer in certain ARM microcontroller families:
 +
 
 +
<ul>
 +
*  https://www.sciencedirect.com/topics/engineering/main-stack-pointer
 +
</ul>
 +
 
 +
<!-- comentario -->
  
 
== [[#top|^]] Manufacturers of Microcontrollers ==
 
== [[#top|^]] Manufacturers of Microcontrollers ==
Line 20: Line 73:
 
*  [[microcontrollers-microchip|Microchip]]
 
*  [[microcontrollers-microchip|Microchip]]
 
*  [[micros-socs-sips-nordicsemi|Nordic]]
 
*  [[micros-socs-sips-nordicsemi|Nordic]]
 +
*  [https://gaisler.com/ Cobham Gaisler AB] - Sparc and Risc-V microcontrollers
 +
<ul>
 +
*  [https://gaisler.com/index.php/company/research/diploma-thesis-mainmenu-111 Frontgrade Gaisler research theses]
 +
*  [https://hackaday.com/2023/03/28/history-of-the-sparc-cpu-architecture/ Hackaday SPARC history article] - history of SPARC CPU architecture
 +
</ul>
 
</ul>
 
</ul>
 
Not yet visited:
 
Not yet visited:
Line 29: Line 87:
 
*  Qualcomm
 
*  Qualcomm
 
</ul>
 
</ul>
 +
 +
<!-- odne komentar -->
 +
 +
== [[#top|^]] Dev Boards and Single Board Computers ==
 +
 +
IMX board or hardware by NXP:
 +
 +
*  https://www.nxp.com/design/training/build-your-first-zephyr-application-on-i-mx-rt:TIP-BUILD-YOU-FIRST-ZEPHYR-APPLICATION-IMX-RT-OD
 +
 +
TinyK22 board from MCUOnEclipse (university development team?) cerca 2017:
 +
 +
*  https://mcuoneclipse.com/2017/12/08/first-tinyk22-board-with-nxp-k22fn512-arm-cortex-m4f/
 +
 +
How to configure clock using MCUXpresso for TinyK22 board and NXP K22FN512 microcontroller:
 +
 +
*  https://mcuoneclipse.com/2020/02/16/tutorial-maximum-clock-frequency-for-kinetis-using-mcuxpresso-clock-tools/
 +
 +
<!-- odne komentar -->
  
 
== [[#top|^]] NordicSemi ==
 
== [[#top|^]] NordicSemi ==
Line 51: Line 127:
 
Hmm, what we thought was a code bundle, code examples has only pre-built binaries.  This developers' forum post spells out in detail what was available -- three demos only -- in 2019.  See the replies from Nordic's engineer Oyvind:
 
Hmm, what we thought was a code bundle, code examples has only pre-built binaries.  This developers' forum post spells out in detail what was available -- three demos only -- in 2019.  See the replies from Nordic's engineer Oyvind:
 
*  https://devzone.nordicsemi.com/f/nordic-q-a/43768/nrf9160-project-setup-tutorial
 
*  https://devzone.nordicsemi.com/f/nordic-q-a/43768/nrf9160-project-setup-tutorial
 +
  
 
2021-07-25<br />
 
2021-07-25<br />
This may be the best "getting started" page at Nordic:
+
First URL in following list of three URLs may be the best "getting started" page at Nordic.  Note also <b> samples and demos </b> page:
 
<ul>
 
<ul>
 
*  https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/getting_started.html
 
*  https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/getting_started.html
Line 62: Line 139:
 
</ul>
 
</ul>
  
 +
<!-- comment -->
 
=== [[#top|^]] Hard to locate nRF9160 DK schematic! ===
 
=== [[#top|^]] Hard to locate nRF9160 DK schematic! ===
 
A page at Nordicsemi which links to schematics in a larger downloadable file, or so claimed:
 
A page at Nordicsemi which links to schematics in a larger downloadable file, or so claimed:
Line 123: Line 201:
 
   142  newtmgr -c serial reset
 
   142  newtmgr -c serial reset
 
</pre>
 
</pre>
 +
 +
A helpful CircuitDojo community post on newtmgr:
 +
 +
*  https://community.jaredwolff.com/d/185-nmp-timeout-when-attempting-to-flash-board/26
 +
 
Installing examples and needed toolchain pieces on Linux hosts:
 
Installing examples and needed toolchain pieces on Linux hosts:
 
*  https://learn.sparkfun.com/tutorials/nrf9160-thing-plus-hookup-guide#sdk-setup---linuxubuntu
 
*  https://learn.sparkfun.com/tutorials/nrf9160-thing-plus-hookup-guide#sdk-setup---linuxubuntu
Line 134: Line 217:
 
*  https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/boards/arm/sparkfun_thing_plus_nrf9160/doc/index.html
 
*  https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/boards/arm/sparkfun_thing_plus_nrf9160/doc/index.html
  
 +
<span id="anchor_local_page_west_build_commands"></span>
 
Given this tie in with Nordic nRF9160 SDK which appears to be part of Zephyr project example codes, the two builds we're trying to achieve so far from Nordic SDK / Zephyr include:
 
Given this tie in with Nordic nRF9160 SDK which appears to be part of Zephyr project example codes, the two builds we're trying to achieve so far from Nordic SDK / Zephyr include:
<pre>
+
 
 
   west build -b nrf9160dk_nrf9160@1.0.0 ./samples/basic/blinky
 
   west build -b nrf9160dk_nrf9160@1.0.0 ./samples/basic/blinky
 
   west build -b sparkfun_thing_plus_nrf9160 samples/hello_world
 
   west build -b sparkfun_thing_plus_nrf9160 samples/hello_world
</pre>
+
  west build -b circuitdojo_feather_nrf9160ns -p
 +
 
 +
Not sure in which SDK the second build command worked.  That particular board is not found in Nordic's ncs v1.4.1 SDK.  The <code>-p</code> option is <code>west</code>'s pristine option, essentially causing a rebuild of the project and allowing one to switch board types which the build targets.
 +
 
 
Note also if we change working directories into a particular example code we then omit the final argument, the relative path to an example code in the above snippet here.  A successful build of 'hello-world' gives these messages:
 
Note also if we change working directories into a particular example code we then omit the final argument, the relative path to an example code in the above snippet here.  A successful build of 'hello-world' gives these messages:
  
Line 252: Line 339:
  
 
<!-- comment -->
 
<!-- comment -->
 
  
 
== [[#top|^]] Build comparison across hosts ==
 
== [[#top|^]] Build comparison across hosts ==
Line 296: Line 382:
 
};
 
};
 
</pre>
 
</pre>
 +
 +
More on Device Tree Source files in [[device_tree_source_files|local Neela page on DTS files]], starting with examination of Zephyr example code.
  
 
<!-- comment -->
 
<!-- comment -->
Line 307: Line 395:
  
 
<!-- comment -->
 
<!-- comment -->
 +
<span id="nn_anchor_processors"></span>
 +
 +
== [[#top|^]] Microprocessors ==
 +
 +
2024-02-05 Starting section for references to and notes about microprocessors . . .
 +
 +
*  https://www.intel.com/content/www/us/en/products/sku/64617/intel-xeon-processor-e52420-15m-cache-1-90-ghz-7-20-gts-intel-qpi/specifications.html
 +
 +
ARCv3 processors . . .
 +
 +
*  https://www.synopsys.com/dw/ipdir.php?ds=arc-hs6x-processors  HS66 and HS68 processors
 +
 +
*  https://foss-for-synopsys-dwc-arc-processors.github.io/toolchain/baremetal/gcc-mcpu.html  gcc toolchain ARC processor families support.
 +
 +
<!-- odne komentar -->
  
 
== [[#top|^]] References ==
 
== [[#top|^]] References ==

Latest revision as of 19:27, 3 June 2024

2021-07-09 Friday

Notes On Microcontrollers And Processors

- neela nurseries keywords template here -
Keywords: two builds west build commands newtmgr


^ Overview

This local wiki page a starting point for general notes on microcontrollers cerca 2020. This local neela wiki article uses the abbreviation "MCU" to mean microcontroller. A few particular MCU families have their own notes pages on this wiki. As of 2022 Q3 these MCU families include:

 

This local page includes notes on microprocessors, also referred to as "processors".


^ Electrical Matters in MCUs


^ MCU Families Early and Middle 2020s

stub section


^ ARM microcontrollers

Here information and links regarding low power modes in ARM Cortex M0, M4 and M33 family microcontrollers . . .

Useful article on how to debug hardfaults on many ARM microcontrollers, and notes on special registers to read for this debugging purpose:

Main stack pointer in certain ARM microcontroller families:


^ Manufacturers of Microcontrollers

Manufacturers visited:

Not yet visited:

    • Cypress Semiconductor
    • Renesas of Japan
    • Silabs
    • Dialog
    • Qualcomm


^ Dev Boards and Single Board Computers

IMX board or hardware by NXP:

TinyK22 board from MCUOnEclipse (university development team?) cerca 2017:

How to configure clock using MCUXpresso for TinyK22 board and NXP K22FN512 microcontroller:


^ NordicSemi

An nRF9160 development kit:

Notes on building, flashing to board, and testing example vRF9160 projects and demos:

^ nRF9160 Getting Started Pages

2021-07-20 Tuesday Searching at NordicSemi.com specifically for example code for the nRF9160:

The most important information for firmware starting works at this link for nRF9160 SDK. Note that there is mention of Zephyr RTOS integration:

Hmm, what we thought was a code bundle, code examples has only pre-built binaries. This developers' forum post spells out in detail what was available -- three demos only -- in 2019. See the replies from Nordic's engineer Oyvind:


2021-07-25
First URL in following list of three URLs may be the best "getting started" page at Nordic. Note also samples and demos page:

^ Hard to locate nRF9160 DK schematic!

A page at Nordicsemi which links to schematics in a larger downloadable file, or so claimed:

Another link seemingly close to the schematic but not getting us there:


^ nRF9160 SDK supported boards

nRF9160 Development Kit (DK) boards:

Smaller dev board from Sparkfun, Thingy:91 . . .


^ nRF9160 Thing Plus by Sparkfun

Some notes on Sparkfun development board named nRF9160 Thing Plus</b>:

How to configure and drive UART on nRF9160:


^ ARM Cortex-M33 CMSIS

ARM Cortex-M33 hardware abstraction layer and CMSIS details here:

Explore and download CMSIS from Github:


^ Sparkfun Thing Plus example code and tools

Working with Sparkfun nRF9160 based Thing Plus, Sparkfun's following page instructs how to install newtmgr:

A couple of useful newtmgr commands include:

  141  newtmgr conn add serial type=serial connstring='dev=/dev/ttyUSB0,baud=1000000'
  142  newtmgr -c serial reset

A helpful CircuitDojo community post on newtmgr:

Installing examples and needed toolchain pieces on Linux hosts:

When attached via USB-C cable, Sparkfun's Thing Plus appears this way in an `lsusb` listing:

   Bus 002 Device 005: ID 10c4:ea60 Silicon Labs CP210x UART Bridge

Back to Nordic example code, the nRF9160 Thing Plus is a supported board there:

Given this tie in with Nordic nRF9160 SDK which appears to be part of Zephyr project example codes, the two builds we're trying to achieve so far from Nordic SDK / Zephyr include:

  west build -b nrf9160dk_nrf9160@1.0.0 ./samples/basic/blinky
  west build -b sparkfun_thing_plus_nrf9160 samples/hello_world
  west build -b circuitdojo_feather_nrf9160ns -p

Not sure in which SDK the second build command worked. That particular board is not found in Nordic's ncs v1.4.1 SDK. The -p option is west's pristine option, essentially causing a rebuild of the project and allowing one to switch board types which the build targets.

Note also if we change working directories into a particular example code we then omit the final argument, the relative path to an example code in the above snippet here. A successful build of 'hello-world' gives these messages:

ted@localhost:~/projects/nordicsemi$ date
Mon 02 Aug 2021 06:33:26 AM PDT 

ted@localhost:~/zephyrproject/zephyr/samples/hello_world$ ls
CMakeLists.txt  prj.conf  README.rst  sample.yaml  src 
ted@localhost:~/zephyrproject/zephyr/samples/hello_world$ west build -b sparkfun_thing_plus_nrf9160
-- west build: generating a build system
Including boilerplate (Zephyr base): /home/ted/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/ted/zephyrproject/zephyr/samples/hello_world
-- Zephyr version: 2.6.99 (/home/ted/zephyrproject/zephyr), build: zephyr-v2.6.0-1460-g17d2e9d084b2
-- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.10") found components: Interpreter 
-- Found west (found suitable version "0.11.0", minimum required is "0.7.1")
-- Board: sparkfun_thing_plus_nrf9160
-- Cache files will be written to: /home/ted/.cache/zephyr
-- Using toolchain: zephyr 0.12.4 (/opt/zephyr-sdk-0.12.4)
-- Found dtc: /opt/zephyr-sdk-0.12.4/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/ted/zephyrproject/zephyr/boards/arm/sparkfun_thing_plus_nrf9160/sparkfun_thing_plus_nrf9160.dts
sparkfun_thing_plus_nrf9160.dts.pre.tmp:58.42-70.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/flash-controller@39000: duplicate unit-address (also used in node /soc/peripheral@50000000/kmu@39000)
sparkfun_thing_plus_nrf9160.dts.pre.tmp:310.19-316.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@50000000/power@5000)
-- Generated zephyr.dts: /home/ted/zephyrproject/zephyr/samples/hello_world/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/ted/zephyrproject/zephyr/samples/hello_world/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/ted/zephyrproject/zephyr/samples/hello_world/build/zephyr/include/generated/device_extern.h
Parsing /home/ted/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/ted/zephyrproject/zephyr/boards/arm/sparkfun_thing_plus_nrf9160/sparkfun_thing_plus_nrf9160_defconfig'
Merged configuration '/home/ted/zephyrproject/zephyr/samples/hello_world/prj.conf'
Configuration saved to '/home/ted/zephyrproject/zephyr/samples/hello_world/build/zephyr/.config'
Kconfig header saved to '/home/ted/zephyrproject/zephyr/samples/hello_world/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- The ASM compiler identification is GNU 
-- Found assembler: /opt/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ted/zephyrproject/zephyr/samples/hello_world/build
-- west build: building application
[1/145] Preparing syscall dependency handling

[138/145] Linking C executable zephyr/zephyr_prebuilt.elf

[145/145] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       16492 B         1 MB      1.57%
            SRAM:        4072 B        64 KB      6.21%
        IDT_LIST:          0 GB         2 KB      0.00%
ted@localhost:~/zephyrproject/zephyr/samples/hello_world$


^ Zephyr docs on Sparkfun nRF9160 Thing Plus


^ Nordic ncs - nRF Connect Software development kit

Looking further for Sparkfun's named or implied example code projects for Sparkfun's nRF9160 Thing Plus, finding that ncs SDK is elusive. There is mention of this SDK in Sparkfun's "nRF9160 Thing Plus Hookup Guide". One Devzone member Raj also mentions it in response to a post of IIoT team. But it's not obvious from where to download ncs from any of the following pages:

'Ah' moment! Here is a URL to the page and anchor point of NordicSemi, of which Devzone engineer Marte was speaking:

Also important, and more insight into nRF SDK or Software Development Kit, following links include intro, west manifest, and ncs release notes:

Finally, a git repository and command to obtain Software Development Kit 'ncs', in this case version 1.4.1:

Following instruction from:

*  https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.4.1/nrf/gs_installing.html
*  https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.4.1/nrf/gs_installing.html#id1

Command to indirectly clone one or more repositories under the git v1.4.1 ncs repository a west meta-tool project space. Wording the description this way because the following command pulls multiple things down from github to an end user's current directory but none of these are named 'v1.4.1':

$ west init -m https://github.com/nrfconnect/sdk-nrf --mr v1.4.1


Among those code repos pulled by west the Zephyr RTOS project instance here is at commit hash:

ted@localhost:~/projects/embedded/ncs/v1.4.1/zephyr$ git log
commit e34b2f477e1adc26b66690171508bfa102eb8538 (HEAD, tag: v2.4.0-ncs2-rc1, tag: v2.4.0-ncs2, manifest-rev)
Author: Joakim Andersson <joakim.andersson@nordicsemi.no>
Date:   Fri Nov 20 14:44:03 2020 +0100

    [nrf noup] Bluetoooth: Add experimental for non-qualified options
    
    Zephyr controller does not yet have a qualification for this release.
    Bluetooth Mesh does not yet have a qualification for this release.
    
    Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>


Within ncs v1.4.1 the basic blinky demo may be compiled for Sparkfun's nRF9160 Thing Plus board:

ted@localhost:~/projects/embedded/ncs/v1.4.1/zephyr/samples/basic/blinky$ west build -b circuitdojo_feather_nrf9160ns

And per Sparkfun's Thing Plus Hookup guide this dev board may be flashed with:

 newtmgr -c serial image upload build/zephyr/app_update.bin


^ Build comparison across hosts

Something strange afoot: building Sparkfun Thing Plus, Zephyr blinky demo, produces differing output files across two hosts. Specifically attempts to build blinky example code per Jared Wolff's guide produce different sets of executables. The latter on a native Linux host produces among many file a file named app_update.bin. Building same project, in same commit of Zephyr project as downloaded by `west` in ncs v1.4.1 does not product nor mention any app_update.bin.

Build messages from a native Ubuntu Linux host and a virtual machine running Linux within host OS Windows linked here:

*  Zephyr build on native Ubuntu host
*  Zephyr build on VirtualBox VM

Found a local change to blink example prj.conf file:

Code excerpt x:

CONFIG_GPIO=y

## 2021-08-02 adding stanza per https://learn.sparkfun.com/tutorials/nrf9160-thing-plus-hookup-guide#example---blinky:
CONFIG_BOOTLOADER_MCUBOOT=y

Device tree related file for Sparkfun, CircuitDojo nRF9160 Thing Plus board. We will likely need to understand and adapt this file going forward with works involving nRF9160 SiP:

/*
 * Copyright (c) 2018-2020 Nordic Semiconductor ASA
 * Copyright (c) 2020 Circuit Dojo LLC
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/dts-v1/;
#include <nordic/nrf9160_sica.dtsi>
#include "circuitdojo_feather_nrf9160_common.dts"

/ {
        chosen {
                zephyr,sram = &sram0_s;
                zephyr,flash = &flash0;
                zephyr,code-partition = &slot0_partition;
                zephyr,sram-secure-partition = &sram0_s;
                zephyr,sram-non-secure-partition = &sram0_ns;
        };
};

More on Device Tree Source files in local Neela page on DTS files, starting with examination of Zephyr example code.


^ Microcontroller Qualities and Considerations

Low power benchmark testing:

Out of Order Execution:

^ Microprocessors

2024-02-05 Starting section for references to and notes about microprocessors . . .

ARCv3 processors . . .


^ References

Util nrfjprog suppposedly here:

Using Docker build an ncs project ( if we can find nsc software development kit! - TMH ):


- - - top of page - - -