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
| Type | Name | Default | Description |
|---|---|---|---|
| Electrical › Supply | |||
| Boolean | useSupplyPin (from PartialSupplyPin) | false | Show 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.Voltage | VOH (from PartialSupplyPin) | Interfaces.VOH | Logic 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.Current | IQ (from PartialSupplyPin) | 1e-3 | Current drawn from VCC by the peripheral (quiescent consumption, outputs excluded) |
| Boolean | useGroundPin (from PartialSupplyPin) | true | Show the GND pin - unchecked: the peripheral is referenced to the simulation ground (0 V), nothing to wire |
| Electrical › Levels | |||
| Modelica.Units.SI.Voltage | VOL (from PartialUartPins) | Interfaces.VOL | Logic low voltage |
| Modelica.Units.SI.Voltage | VIH (from PartialUartPins) | Interfaces.VIH | Threshold above which an input reads high |
| Modelica.Units.SI.Voltage | VIL (from PartialUartPins) | Interfaces.VIL | Threshold below which an input reads low |
| Electrical › Impedances | |||
| Modelica.Units.SI.Resistance | ROut (from PartialUartPins) | Interfaces.ROut | Output series resistance |
| Modelica.Units.SI.Resistance | RPullUp (from PartialUartPins) | 1e6 | Pull-up of the RX input to the supply |
| Electrical › Pins | |||
| Boolean | useTxPin (from PartialUartPins) | true | Show the TX pin - unchecked for a device that never transmits (its output stage then stays unconnected) |
| Serial link (microcontroller side) | |||
| Integer | baudrate (from PartialRadioModem) | 9600 | Speed of the serial link with the microcontroller, in baud |
| Integer | dataBits (from PartialRadioModem) | 8 | Number of data bits of a serial frame (5 to 8, as machine.UART bits=) |
| Interfaces.UartParity | parity (from PartialRadioModem) | Interfaces.UartParity.None | Parity of a serial frame (as machine.UART parity=: None, 0 = even, 1 = odd) |
| Integer | stopBits (from PartialRadioModem) | 1 | Number of stop bits of a serial frame (1 or 2, as machine.UART stop=) |
| Radio | |||
| Interfaces.Modulation | modulation (from PartialRadioModem) | Interfaces.Modulation.FSK | Modulation of the carrier by the bits of the radio frame - a receiver only hears a transmitter using the same one |
| Modelica.Units.SI.Frequency | fCarrier (from PartialRadioModem) | 434e6 | Nominal carrier frequency (channel) - a receiver only hears a transmitter whose carrier is within half a channel width of its own |
| Modelica.Units.SI.Frequency | channelWidth (from PartialRadioModem) | 200e3 | Width of the channel heard around fCarrier |
| Integer | airBaudrate (from PartialRadioModem) | 9600 | Air data rate, in bit/s - radio frame 8N1, independent of the serial link; both modules must use the same |
| Boolean | halfDuplex (from PartialRadioModem) | true | Deaf while transmitting: a frame arriving during our own transmission is lost (one radio channel cannot carry both directions at once) |
| Buffers and delays | |||
| Integer | txBufferSize (from PartialRadioModem) | 256 | Transmit buffer (UART -> air), in bytes - a byte arriving from the UART while it is full is lost |
| Integer | rxBufferSize (from PartialRadioModem) | 256 | Receive buffer (air -> UART), in bytes - a byte arriving from the air while it is full is lost |
| Modelica.Units.SI.Time | txDelay (from PartialRadioModem) | 0.005 | Fixed delay between the end of a byte on the UART and its earliest transmission on air |
| Modelica.Units.SI.Time | rxDelay (from PartialRadioModem) | 0.001 | Fixed delay between the end of a byte on air and its earliest transmission on the UART |
| Drawn signal › Drawn carrier | |||
| Modelica.Units.SI.Frequency | fDisplay (from PartialRadioModem) | 4*airBaudrate | Scaled 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.Frequency | deltaFDisplay (from PartialRadioModem) | airBaudrate | FSK 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) |
| Real | askLowAmplitude (from PartialRadioModem) | 0.3 | ASK 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 | |||
| Boolean | warnSampling (from PartialRadioModem) | true | Warn 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.Time | tickPeriod (from PartialRadioModem) | 0.1 | Period of the minimal sync point: a safety net, the actual pace comes from the engine's deadlines |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Electrical.Analog.Interfaces.NegativePin | GND (from PartialSupplyPin) | Common reference (ground), to be connected to the microcontroller's one - shown when useGroundPin is checked | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | VCC (from PartialSupplyPin) | Supply of the peripheral (e.g. 3V3(OUT) of a Raspberry Pi Pico) - shown when useSupplyPin is checked | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | TX (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.PositivePin | RX (from PartialUartPins) | Reception of the device - to be connected to the transmit pin of the microcontroller | |
| Interfaces.Antenna | antenna (from PartialRadioModem) | Antenna: connect it with ONE wire to the antenna of the module(s) to talk to |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Real | sTx (from PartialRadioModem) | Modulated signal transmitted, drawn with the scaled carrier fDisplay (0 when not transmitting) - reduce the output interval to see the carrier | |
| Real | sRx (from PartialRadioModem) | Signal of the other transmitter as received by this module, whatever its tuning (0 when no other module transmits) | |
| Boolean | carrierOn (from PartialRadioModem) | carrierOnC | A radio frame is being transmitted |
| Boolean | airRxBusy (from PartialRadioModem) | airRxBusyC | A radio frame is being received |
| Integer | txFill (from PartialRadioModem) | txFillC | Bytes waiting in the transmit buffer (UART -> air) |
| Integer | rxFill (from PartialRadioModem) | rxFillC | Bytes waiting in the receive buffer (air -> UART) |
| Integer | nSent (from PartialRadioModem) | nSentC | Radio frames transmitted so far |
| Integer | nReceived (from PartialRadioModem) | nReceivedC | Radio frames received intact so far |
| Integer | nDropped (from PartialRadioModem) | nDroppedC | Bytes lost so far because a buffer was full |
| Integer | nCorrupted (from PartialRadioModem) | nCorruptedC | Radio frames lost so far: corrupted (air data rate mismatch...), collided, or cut by our own transmission in half duplex |
| Boolean | heard (from PartialRadioModem) | Exactly one other module transmits, on our channel and with our modulation: its frame reaches the decoder | |
| Boolean | collision (from PartialRadioModem) | jam | Two other modules or more transmit at once: the frame being received is lost |