this describes the possible elements of a configuration description in JSON format.
The JSON format is defined here: https://www.json.org/json-en.html
All elements not listed as essential are optional. Being optional means that they can be missing and the configuration is still valid.
If elements that describe a peripheral are not present than that peripheral will not be used. No initialization code for that peripheral will be generated.
If elements that define general settings are missing then the default value for that setting is used. The section describing the element will also state the default value.
The essential elements are :
The settings defined in this file cover different areas.
general settings affect the whole project. These settings are general configurations and switches to enable additional features or to select modes for the project.
peripheral settings are definitions of peripheral configuration. Examples are Pad names, enabled or disabled functionality and Speed settings.
The peripherals can be used in different ways (polling, interrupt, DMA) and for different purposes (“send text”, “send binary packets”, “fixed length packet”, “variable length packet”) and implementing these functionality is device independent. This configuration file should therefore only give guidance to MBSP and select the API style the user want's to use.
The user shall not be bothered with the details of the used peripheral. The user should therefore not depend on peripheral names (“SPI0”, “UART3”, “GPIO PA9”, ..) but refer to these resources by names that make sense for the user. These names are defined in this file.
{ "vendor_name": "Geehy", "chip_name": "APM32F411VC", "digital_output": { "green_led": { "type": "push pull", "pad": "PA3" } } "SPI": { ... } }
Keys like *digital_output* and *SPI* represent group names and are taken from a predefined set of group names understood by MBSP. Keys nested within them are arbitrary user-defined names for a instance in that group. In those instances the keys are from the defined set specific for that group.
these are settings on the top layer that effect the whole project.
Name of the company that sells the micro controller. As listed on https://chipselect.org
type: string
Model number of the micro controller. As listed on https://chipselect.org
type: string
Model number is truncated so that it only contains relevant differences for code generation: flash and ram sizes are relevant, temperature range or package are not.
what type of project to generate.
type: string
default: “make”
Possible values are:
defines the comment at the top of each generated file.
type: string
default: “created”
Possible values are:
defines the location of the firmware code when run.
type: string
default: “flash”
Possible values are:
if you use a “hal only” MBSP project located in a sub folder of your project then the name of the sub folder goes here.
type: string
default: “”
configuration of the used clocks.
"clock": { "cpu": { "source" : "hse", "frequency" : "12 MHz", } }
defines the source of the clock signal. Supported clock sources are:
type: enum
default: hse
defines the frequency that this clock has.
type: string (Hz, kHz, MHz)
default: “1 MHz”
This group contains all digital output signals.
Each signal is a sub group with the signal name as the group name.
"digital_output": { "green_led": { "type": "push pull" "pad": "PA3" } }
defines what type of output mode should be used. Type can be:
type: enum
default: push pull
defines the chip pad that the signal should be output on.
type: string
default: no default possible
If this setting is set to “on” then turning this output “on” will generate a Low (Gnd) signal. Turning it “off” will generate a High (Vcc) level.
If this setting is set to “off” (=default) then turning this output “on” will generate a High (Vcc) signal. Turning it “off” will generate a Low (Gnd) level.
type: string
default: “off”
This group contains all digital input signals.
Each signal is a sub group with the signal name as the group name.
defines the chip pad that the signal should be read from.
type: string
TBD
TBD
This group contains all timer and counter peripherals.
"timer": { "ms_tick": { "peripheral" : "systick", "mode" : "count overflows", "frequency" : "1 kHz", } }
defines which peripheral to use. peripherals can be:
type: String
default: systick
defines the operation mode the timer/counte operates in. Possible modes are:
type: enum
default: count overflows
The frequency defines the time between timer overflows. 1kHz means that the time between overflow events is 1/(1 kHz) = 1 ms.
type: string (Hz, kHz, MHz)
default: “1 kHz”
TBD
This group defines all used Universal Asynchronous Receiver Transmitter (UART) interfaces.
Each UART is a sub group with the UART name as the group name.
"UART": { "debug_uart": { "pad_tx": "PA5", "pad_rx": "PA6", "pad_cts": "PA7", "pad_rts": "PA15", "bits_per_packet": "8", "parity": "None", "stop_bits": "1", "baud_rate": "115200", "hardware_flow_control": "no", "receive_buffer_size": "100", "send_buffer_size": "500", "peripheral" : "UART0", "IRQ" : "20", "IRQ_priority" : "0", } }
The UART will send data on this pin. (Idle = High). Either this or the pad_rx must be given.
The UART will receive (read) signals on this pin. Either this or pad_rx must be given.
Clear to send signal for flow control. Will not be used if not defined.
Request to Send signal for flow control. Will not be used if not defined.
defines the number of data bits. Possible values are:
type: enum
default: 8
defines the parity bit. Possible values are:
type: enum
default: None
defines the number of stop bits. Possible values are:
type: enum
default: 8
defines the number of bits send per second.
type: int
default: 115200
defines if the Request to Send (RTS) and Clear to send (CTS) signals should be used for flow control. Possible values are:
type: enum
default: off
defines the number of bytes in the receive buffer of the driver.
type: int
default: 100
defines the number of bytes in the send buffer of the driver.
type: int
default: 500
name of the UART peripheral to use.
type: String
The interrupt number of the peripheral.
type: int
The interrupt priority of the interrupt.
type: int
This group defines all used Serial Peripheral Interface (SPI) interfaces.
Each SPI interface is a sub group with the SPI name as the group name.
"SPI": { "encoder_spi": { "pad_sck": "PA5", "pad_miso": "PA6", "pad_mosi": "PA7", "pad_ncs": "PA15", "role": "master", "communication_mode": "duplex", "frame_format": "motorola", "clock_polarity": "idle_low", "clock_phase": "sample_on_leading_edge", "bit_order": "msb_first", "baud_rate": "10 MHz", } }
Serial Clock.
“Master Out Slave In” data signal.
“Master In Slave Out” data signal.
Chip Select signal (Low active).
Is either master(host) or slave(device).
type: enum
default: master
Describes the communication. Possible values are:
type: enum
default: duplex
Describes the communication. Possible values are:
type: enum
default: motorola
Also often called CPOL. Describes the communication. Possible values are:
type: enum
default: idle_low
Also often called CPHA. Describes the communication. Possible values are:
type: enum
default: sample_on_leading_edge
Sometimes the documentation talks about a SPI Mode with the value of 0 to 3. This mode maps to the phase and polarity as described in the following table:
Mode | CPOL | CPHA | description |
---|---|---|---|
0 | 0 | 0 | clock: idle_low, phase: sample_on_leading_edge |
1 | 0 | 1 | clock: idle_low, phase: sample_on_trailing_edge |
2 | 1 | 0 | clock: idle_high, phase: sample_on_leading_edge |
3 | 1 | 1 | clock: idle_high, phase: sample_on_trailing_edge |
Describes the communication. Possible values are:
type: enum
default: msb_first
Is the number of bits per second exchanged on the data lines. Expressed as frequency of the clock line.
type: int (Hz)