.131 WK 7-10 Flashcards
Microprocessor - Ioannis Chatzigeorgiou
Define runtime code/software:
software platform that provides an environment for executing user code - serves as an abstraction layer that developers can use to write software
Define a microcontroller unit (MCU):
compact integrated circuit equipped w/ 1 or more CPUs + memory - similar to a system on a chip
Define an embedded system:
electronic product comprised of one or more microcontrollers executing software instructions stored on a memory module to perform an essential function
Which component streams data to/from the microbit and provides power?
micro USB
What does a micro USB do?
streams data to/from the microbit and provides power
What does the ARM Cortex-M4F processor deal with?
interface that handles USB connection - used for flashing code + Tx/Rx data to/from devices
What does the ARM Cortex-M4 32-bit processor deal with?
user + runtime code + Bluetooth stack can run from flash memory, custom radio capabilities + integrated temp sensor
Which processor deals with the USB connection?
ARM Cortex-M4F
Which processor deals with user + runtime code?
ARM-Cortex-M4 32-bit
How does the microbit communicate?
via BLE antenna - peripheral that talks to central devices only + also uses radio to communicate w/ other microbits!!
What does the motion sensor include?
an accelerometer + magnetometer - sensor will either be LSM or FXOS
How does the microbit connect to external components?
clips/plugs to the edge connector - 20 pins/strips with 5 rings
What does the regulator do?
steps down voltage
What is Xtal for?
electronic crystal oscillator that provides clock signal
What buses are there in a microbit?
SWD, UART, I2C (external + internal)
What does SWD do?
stands for serial wire debug - for programming target MCU (processor)
What does UART do?
stands for universal asynchronous receiver transmitter - for exchanging data w/ device connected via USB
What does I2C do?
stands for inter-integrated circuit bus - allows main component (target MCU) to communicate w/ secondary components
Which bus deals with programming target MCU?
SWD
Which bus deals with data for device connected via USB?
UART
Which bus deals with communication between the target MCU and secondary components?
I2C
what does the MicroBit class do?
consists of variables + methods that operate as drivers to control commonly used microbit features
instantiate as MicroBit uBit;
then initialise with uBit.init();
what modes can you set uBit.display to
setDisplayMode(x):
-DISPLAY_MODE_BLACK_AND_WHITE = each pixel is on/off (can control brightness but for ALL) - most efficient (processing time + battery power)
- DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE = same as above but display drivers also sense ambient brightness from LEDs
- DISPLAY_MODE_GREYSCALE = each pixel can independently have 256 levels of brightness
How to intialise an MicroBitImage?
MicroBitImage var (“0, 255, 0, 0, 0\n…);
OR
const unint8_t var[] = {0, 1, 0, 0…); then MicroBitImage image (5, 5, var);
How to display an image?
uBit.display.print(image);
How to change pixel in image?
image.setPixelValue(x, y, 0/1);
How to find value of pixel in image?
uBit.display.image.getPixelValue(x,y)
What button objects are available?
uBit.buttonA, uBit.buttonB (MicroBitButton) + uBit.buttonAB (combined input - MicroBitMultiButton)
How to find out if a button has been pressed?
.isPressed() - returns 1 if pressed and 0 if not
What deals with asynchronous programming for microbits?
message bus can listen for events + call a function (event handler) when it occurs
uBit.messageBus.listen(component, event, function);
What does release_fiber() do?
stops the end of execution so the program will wait and listen for events even if the compiler has reached the end of the program
What is the wildcard for events?
MICROBIT_EVT_ANY
What does uBit.thermometer.getTemperature() do?
gets integer value representative of surface temp of application MCU (not the ambient temp!!)
What does the log do?
enables a table-like format containing rows of readings/data
What are the functions associated with log?
beginRow() - open file + create new row
logData(“column label”, “value”) = add data
endRow() = complete logging + close file
How to make log file visible in file explorer?
uBit.log.setVisibility(true);
What is firmware?
midway between hardware + software
permenant software that provides low-level control of device hardware
What is the firmware for a microbit?
DAPLink
open-source interface firmware
What does DAPLink do?
- creates bridge between PC + SWD
- micro:bit presents self like a USB disk
- enables drag + drop programming w/o installing drivers
- compatible w/ Windows, MacOS + Linux (mainly Linux)
- Interface mode - hex file dropped onto USB disk is written to target MCU flash - name of USB disk = MICROBIT
- Bootloader mode - hex file dropped onto USB disk is written to interface MCU flash + updates version of DAPLink - name of USB disk = MAINTENANCE
What software does the microbit have?
- nRF5 Software Dev. Kit
- Component Oriented Device Abstraction Layer
- Porgraming Lanaguages - Python, C/C++ and MakeCode
Microbit software: nRF5 Software Dev. Kit
- rich development environment for nRF52/52 sereies MCUs
- provides hardware abstraction
- inc. drivers, libraries, example peripherals + radio protocols
Microbit software: Component Oriented Device Abstraction Layer
- micro:bit runtime software
- C/C++
- abstracts hardware components as software components rep by C++ classes
- offers eventing subsystem for mapping asynchronous events to event handlers
Microbit software: Programming Languages
- interpreted (Python) - user code + interpreter are copied into target MCU -allow users to program micro:bit live over USB
- compiled (C/C++) - user code is compiled → ARM assembly
- editors (MakeCode) - high-level programming using blocks