modelOnBoardRadioModem

The on-board 2.4 GHz radio of the micro:bit as a transparent modem: the same engine as Peripherals.Radio.RadioModem, mounted inside MicroBit_v2 on two internal pins of the core (34 = TX of the core, 35 = RX) - the packet protocol of microbit.radio (framing, channel/group/address filtering, receive queue) lives in the Python shim, see requirements.md decision "Radios micro:bit"

Extends from PartialRadioModem (Base of the transparent radio modems: serial link with the microcontroller, radio frames on air, buffers, fixed delays, drawn modulated signal).

Information

The on-board radio of MicroBit_v2, built on the generic radio modem: PartialRadioModem with every parameter final - the board stays a radio black box, the channel, group, address and data rate are set from the program by radio.config(), as on the real board. All the microbit.radio semantics (packet framing with a delimiter, byte stuffing and a CRC, filtering, receive queue of depth queue, truncation to length) are implemented in the Python shim, on top of the internal UART (slot 1) that links the core to this modem.

Parameters

TypeNameDefaultDescription
Electrical › Supply
BooleanuseSupplyPin (from PartialSupplyPin)falseShow the VCC supply pin: the peripheral is supplied by the circuit (its high levels follow VCC, its consumption IQ is drawn from VCC) - unchecked: ideal internal supply VOH, nothing to wire
Modelica.Units.SI.VoltageVOH (from PartialSupplyPin)Interfaces.VOHLogic high voltage: ideal internal supply, high level of the outputs and of the pull-ups - with the VCC pin, the voltage of VCC is used instead
Modelica.Units.SI.CurrentIQ (from PartialSupplyPin)1e-3Current drawn from VCC by the peripheral (quiescent consumption, outputs excluded)
BooleanuseGroundPin (from PartialSupplyPin)trueShow the GND pin - unchecked: the peripheral is referenced to the simulation ground (0 V), nothing to wire
Electrical › Levels
Modelica.Units.SI.VoltageVOL (from PartialUartPins)Interfaces.VOLLogic low voltage
Modelica.Units.SI.VoltageVIH (from PartialUartPins)Interfaces.VIHThreshold above which an input reads high
Modelica.Units.SI.VoltageVIL (from PartialUartPins)Interfaces.VILThreshold below which an input reads low
Electrical › Impedances
Modelica.Units.SI.ResistanceROut (from PartialUartPins)Interfaces.ROutOutput series resistance
Modelica.Units.SI.ResistanceRPullUp (from PartialUartPins)1e6Pull-up of the RX input to the supply
Electrical › Pins
BooleanuseTxPin (from PartialUartPins)trueShow the TX pin - unchecked for a device that never transmits (its output stage then stays unconnected)
Serial link (microcontroller side)
Integerbaudrate (from PartialRadioModem)9600Speed of the serial link with the microcontroller, in baud
IntegerdataBits (from PartialRadioModem)8Number of data bits of a serial frame (5 to 8, as machine.UART bits=)
Interfaces.UartParityparity (from PartialRadioModem)Interfaces.UartParity.NoneParity of a serial frame (as machine.UART parity=: None, 0 = even, 1 = odd)
IntegerstopBits (from PartialRadioModem)1Number of stop bits of a serial frame (1 or 2, as machine.UART stop=)
Radio
Interfaces.Modulationmodulation (from PartialRadioModem)Interfaces.Modulation.FSKModulation of the carrier by the bits of the radio frame - a receiver only hears a transmitter using the same one
Modelica.Units.SI.FrequencyfCarrier (from PartialRadioModem)434e6Nominal carrier frequency (channel) - a receiver only hears a transmitter whose carrier is within half a channel width of its own
Modelica.Units.SI.FrequencychannelWidth (from PartialRadioModem)200e3Width of the channel heard around fCarrier
IntegerairBaudrate (from PartialRadioModem)9600Air data rate, in bit/s - radio frame 8N1, independent of the serial link; both modules must use the same
BooleanhalfDuplex (from PartialRadioModem)trueDeaf while transmitting: a frame arriving during our own transmission is lost (one radio channel cannot carry both directions at once)
Buffers and delays
IntegertxBufferSize (from PartialRadioModem)256Transmit buffer (UART -> air), in bytes - a byte arriving from the UART while it is full is lost
IntegerrxBufferSize (from PartialRadioModem)256Receive buffer (air -> UART), in bytes - a byte arriving from the air while it is full is lost
Modelica.Units.SI.TimetxDelay (from PartialRadioModem)0.005Fixed delay between the end of a byte on the UART and its earliest transmission on air
Modelica.Units.SI.TimerxDelay (from PartialRadioModem)0.001Fixed delay between the end of a byte on air and its earliest transmission on the UART
Drawn signal › Drawn carrier
Modelica.Units.SI.FrequencyfDisplay (from PartialRadioModem)4*airBaudrateScaled carrier used to draw sTx (a real one, hundreds of MHz, cannot be drawn). Default 4*airBaudrate = 4 periods per bit: 4.8 kHz at 1200 bit/s, 38.4 kHz at 9600 bit/s
Modelica.Units.SI.FrequencydeltaFDisplay (from PartialRadioModem)airBaudrateFSK only: shift of the drawn carrier, fDisplay - deltaFDisplay for a 0, fDisplay + deltaFDisplay for a 1. Default airBaudrate: 3 and 5 periods per bit (28.8 and 48 kHz at 9600 bit/s)
RealaskLowAmplitude (from PartialRadioModem)0.3ASK only: amplitude of the drawn carrier for a 0 (1 for a 1). 0 looks like OOK, 0.3 is clearly visible, above 0.7 a 0 is hard to tell from a 1
Drawn signal › Simulation
BooleanwarnSampling (from PartialRadioModem)trueWarn in the log when the output interval is too long to draw the carrier: more than 1/(10*(fDisplay + deltaFDisplay in FSK)), i.e. 2.1 us at 9600 bit/s with the defaults
Modelica.Units.SI.TimetickPeriod (from PartialRadioModem)0.1Period of the minimal sync point: a safety net, the actual pace comes from the engine's deadlines

Connectors

TypeNameDefaultDescription
Modelica.Electrical.Analog.Interfaces.NegativePinGND (from PartialSupplyPin)Common reference (ground), to be connected to the microcontroller's one - shown when useGroundPin is checked
Modelica.Electrical.Analog.Interfaces.PositivePinVCC (from PartialSupplyPin)Supply of the peripheral (e.g. 3V3(OUT) of a Raspberry Pi Pico) - shown when useSupplyPin is checked
Modelica.Electrical.Analog.Interfaces.PositivePinTX (from PartialUartPins)Transmission of the device - to be connected to the receive pin of the microcontroller - shown when useTxPin is checked
Modelica.Electrical.Analog.Interfaces.PositivePinRX (from PartialUartPins)Reception of the device - to be connected to the transmit pin of the microcontroller
Interfaces.Antennaantenna (from PartialRadioModem)Antenna: connect it with ONE wire to the antenna of the module(s) to talk to

Components

TypeNameDefaultDescription
RealsTx (from PartialRadioModem)Modulated signal transmitted, drawn with the scaled carrier fDisplay (0 when not transmitting) - reduce the output interval to see the carrier
RealsRx (from PartialRadioModem)Signal of the other transmitter as received by this module, whatever its tuning (0 when no other module transmits)
BooleancarrierOn (from PartialRadioModem)carrierOnCA radio frame is being transmitted
BooleanairRxBusy (from PartialRadioModem)airRxBusyCA radio frame is being received
IntegertxFill (from PartialRadioModem)txFillCBytes waiting in the transmit buffer (UART -> air)
IntegerrxFill (from PartialRadioModem)rxFillCBytes waiting in the receive buffer (air -> UART)
IntegernSent (from PartialRadioModem)nSentCRadio frames transmitted so far
IntegernReceived (from PartialRadioModem)nReceivedCRadio frames received intact so far
IntegernDropped (from PartialRadioModem)nDroppedCBytes lost so far because a buffer was full
IntegernCorrupted (from PartialRadioModem)nCorruptedCRadio frames lost so far: corrupted (air data rate mismatch...), collided, or cut by our own transmission in half duplex
Booleanheard (from PartialRadioModem)Exactly one other module transmits, on our channel and with our modulation: its frame reaches the decoder
Booleancollision (from PartialRadioModem)jamTwo other modules or more transmit at once: the frame being received is lost