Skip to content

Commit b049267

Browse files
silabs-bozontleonardocavagnisfacchinmmcmchris
authored
Release 2.2.0 (#152)
* Implement HIL tests * Remove the redundant pin mappings from the BGM220 Explorer Kit The button and LED pins are connected to the breakout header as well, so their duplicates were removed. * Ensure that GPIOs return to their original state on deinit After a reset the GSDK initializes all periperals - the core deinits them. Some pins remained in a high/initialzed state after this - which is addressed by this commit. - Remove VCOM enable on the Nano Matter - Reset Serial Rx/Tx pins on deinit - Reset Wire SCL/SDA pins on deinit * Fix the sketch paths in the build test script * Implement a 78 MHz CPU clock option The Matter variants use this by default, now it's also user selectable. * Add API for getting the CPU cycle count * Add direct GPIO variant of ezWS2812 * Implement Watchdog Timer support * Improve the BLE HID keyboard example * Implement option in the GSDK generator to keep the gen folder * Patch out peripheral inits in the generated SDK This way deiniting them right after boot is not needed. This also solves the issue of some pins pulsing on startup. Startup time is now faster by 5 milliseconds. * Make the deep sleep escape pin a separate config for each board This allows the pin to be configured to an accessible location on boards without a button. * Fix ambiguous set_pixel() calls in ezWS2812 Calling '.set_pixel(0, 0, 0, 0)' resulted in a compile error, now there's only one signature of set_pixel. * Add BLE scan example * Add the released and bump the dev version in the package index JSON Also replace 'x86_64-mingw32' with 'i686-mingw32' for increased compatibility. * Bump the core version to 2.2.0 * fix: Wire library endTransmission return values * add stop condition in Wire.requestFrom function * Enable the I2C clock in Wire follower mode With the device inits/reinits removed the I2C clock is not enabled by default - we have to enable it separately. * Remove dangling whitespace in Wire.cpp * Wire: properly derive from arduino::HardwareI2C Since the core is based on ArduinoCore-API, certain libraries will make assumptions on full compatibility * Add analogReadResolution function * Add a python variant of the bootstrap script * Add support for the Seeed Studio Xiao MG24 * Update matter_decommission.ino Adding the `decommission_handler()` to the `setup()` process to avoid blocking. --------- Co-authored-by: Leonardo Cavagnis <[email protected]> Co-authored-by: Martino Facchin <[email protected]> Co-authored-by: Christopher Méndez <[email protected]>
1 parent 9bff82c commit b049267

File tree

3,186 files changed

+1174306
-716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,186 files changed

+1174306
-716
lines changed

boards.txt

+137
Large diffs are not rendered by default.

bootloaders/seeed-studio-xiao-mg24-bootloader-storage-internal-single-512k.hex

+680
Large diffs are not rendered by default.

cores/silabs/Arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ void analogReferenceDAC(uint8_t reference);
103103
typedef enum _dac_channel_t dac_channel_t;
104104
void analogWrite(dac_channel_t dac_channel, int value);
105105
void analogWriteResolution(int resolution);
106+
void analogReadResolution(int resolution);
106107

107108
bool get_system_init_finished();
108109
uint32_t get_system_reset_cause();

cores/silabs/Serial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ UARTClass::UARTClass(sl_iostream_t* stream,
4040
void(*deinit_fn)(void),
4141
void(*serial_event_fn)(void)) :
4242
serial_mutex(nullptr),
43-
initialized(true),
43+
initialized(false),
4444
baudrate(115200),
4545
suspended(false)
4646
{

cores/silabs/adc.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ AdcClass::AdcClass() :
3232
initialized(false),
3333
current_adc_pin(PD2),
3434
current_adc_reference(AR_VDD),
35+
current_read_resolution(this->max_read_resolution_bits),
3536
adc_mutex(nullptr)
3637
{
3738
this->adc_mutex = xSemaphoreCreateMutexStatic(&this->adc_mutex_buf);
@@ -147,6 +148,10 @@ uint16_t AdcClass::get_sample(PinName pin)
147148
uint16_t result = IADC_readSingleData(IADC0);
148149

149150
xSemaphoreGive(this->adc_mutex);
151+
152+
// Apply the configured read resolution
153+
result = result >> (this->max_read_resolution_bits - this->current_read_resolution);
154+
150155
return result;
151156
}
152157

@@ -161,6 +166,14 @@ void AdcClass::set_reference(uint8_t reference)
161166
xSemaphoreGive(this->adc_mutex);
162167
}
163168

169+
void AdcClass::set_read_resolution(uint8_t resolution) {
170+
if (resolution > this->max_read_resolution_bits) {
171+
this->current_read_resolution = this->max_read_resolution_bits;
172+
return;
173+
}
174+
this->current_read_resolution = resolution;
175+
}
176+
164177
const IADC_PosInput_t AdcClass::GPIO_to_ADC_pin_map[64] = {
165178
// Port A
166179
iadcPosInputPortAPin0,

cores/silabs/adc.h

+11
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ class AdcClass {
6868
******************************************************************************/
6969
void set_reference(uint8_t reference);
7070

71+
/***************************************************************************//**
72+
* Sets the ADC read resolution
73+
*
74+
* @param[in] resolution The selected read resolution in bits
75+
******************************************************************************/
76+
void set_read_resolution(uint8_t resolution);
77+
78+
// The maximum read resolution of the ADC
79+
static const uint8_t max_read_resolution_bits = 12u;
80+
7181
private:
7282
/***************************************************************************//**
7383
* Initializes the ADC hardware
@@ -80,6 +90,7 @@ class AdcClass {
8090
bool initialized;
8191
PinName current_adc_pin;
8292
uint8_t current_adc_reference;
93+
uint8_t current_read_resolution;
8394
static const IADC_PosInput_t GPIO_to_ADC_pin_map[64];
8495

8596
SemaphoreHandle_t adc_mutex;

cores/silabs/silabs_additional.cpp

+32-16
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <cstdio>
2828
#include "silabs_additional.h"
29+
#include "arduino_i2c_config.h"
2930
extern "C" {
3031
#include "em_emu.h"
3132
#include "em_cmu.h"
@@ -66,6 +67,19 @@ String getCoreVersion()
6667
return String(ARDUINO_SILABS);
6768
}
6869

70+
// DPLL config for 78 MHz CPU clock - Matter variants default to this
71+
#define DPLL_HFXO_TO_78MHZ \
72+
{ \
73+
78000000, /* Target frequency */ \
74+
3839, /* Factor N */ \
75+
1919, /* Factor M */ \
76+
cmuSelect_HFXO, /* Select HFXO as reference clock */ \
77+
cmuDPLLEdgeSel_Fall, /* Select falling edge of ref clock */ \
78+
cmuDPLLLockMode_Phase, /* Use frequency lock mode */ \
79+
true, /* Enable automatic lock recovery */ \
80+
false /* Don't enable dither function */ \
81+
}
82+
6983
void setCPUClock(cpu_clock_t clock)
7084
{
7185
CMU_DPLLInit_TypeDef pll_init;
@@ -76,6 +90,9 @@ void setCPUClock(cpu_clock_t clock)
7690
case CPU_76MHZ:
7791
pll_init = CMU_DPLL_HFXO_TO_76_8MHZ;
7892
break;
93+
case CPU_78MHZ:
94+
pll_init = DPLL_HFXO_TO_78MHZ;
95+
break;
7996
case CPU_80MHZ:
8097
pll_init = CMU_DPLL_HFXO_TO_80MHZ;
8198
break;
@@ -95,7 +112,8 @@ uint32_t getCPUClock()
95112
return SystemCoreClockGet();
96113
}
97114

98-
void I2C_Deinit(I2C_TypeDef* i2c_peripheral) {
115+
void I2C_Deinit(I2C_TypeDef* i2c_peripheral)
116+
{
99117
I2C_Reset(i2c_peripheral);
100118

101119
// Reset the I2C to GPIO peripheral routing to enable the pins to function as GPIO
@@ -104,36 +122,34 @@ void I2C_Deinit(I2C_TypeDef* i2c_peripheral) {
104122
GPIO->I2CROUTE[0].ROUTEEN = 0;
105123
GPIO->I2CROUTE[0].SCLROUTE = 0;
106124
GPIO->I2CROUTE[0].SDAROUTE = 0;
125+
NVIC_DisableIRQ(I2C0_IRQn);
107126
}
108127
#endif
128+
109129
#if defined(I2C1)
110130
if (i2c_peripheral == I2C1) {
111131
GPIO->I2CROUTE[1].ROUTEEN = 0;
112132
GPIO->I2CROUTE[1].SCLROUTE = 0;
113133
GPIO->I2CROUTE[1].SDAROUTE = 0;
134+
NVIC_DisableIRQ(I2C1_IRQn);
114135
}
115136
#endif
137+
116138
#if defined(I2C2)
117139
if (i2c_peripheral == I2C2) {
118140
GPIO->I2CROUTE[2].ROUTEEN = 0;
119141
GPIO->I2CROUTE[2].SCLROUTE = 0;
120142
GPIO->I2CROUTE[2].SDAROUTE = 0;
143+
NVIC_DisableIRQ(I2C2_IRQn);
121144
}
122145
#endif
123146

124-
#if defined(I2C0)
125-
if (i2c_peripheral == I2C0) {
126-
NVIC_DisableIRQ(I2C0_IRQn);
127-
}
128-
#endif
129-
#if defined(I2C1)
130-
if (i2c_peripheral == I2C1) {
131-
NVIC_DisableIRQ(I2C1_IRQn);
132-
}
133-
#endif
134-
#if defined(I2C2)
135-
if (i2c_peripheral == I2C2) {
136-
NVIC_DisableIRQ(I2C2_IRQn);
137-
}
147+
// Reset the I2C pins to floating input
148+
GPIO_PinModeSet(SL_I2C_SCL_PORT, SL_I2C_SCL_PIN, gpioModeInput, 0);
149+
GPIO_PinModeSet(SL_I2C_SDA_PORT, SL_I2C_SDA_PIN, gpioModeInput, 0);
150+
151+
#if (NUM_HW_I2C > 1)
152+
GPIO_PinModeSet(SL_I2C1_SCL_PORT, SL_I2C1_SCL_PIN, gpioModeInput, 0);
153+
GPIO_PinModeSet(SL_I2C1_SDA_PORT, SL_I2C1_SDA_PIN, gpioModeInput, 0);
138154
#endif
139-
}
155+
}

cores/silabs/silabs_additional.h

+21-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
typedef enum {
3636
CPU_39MHZ,
3737
CPU_76MHZ,
38+
CPU_78MHZ,
3839
CPU_80MHZ
3940
} cpu_clock_t;
4041

@@ -87,6 +88,25 @@ void setCPUClock(cpu_clock_t clock);
8788
******************************************************************************/
8889
uint32_t getCPUClock();
8990

91+
/***************************************************************************//**
92+
* Gets the current CPU cycle count
93+
*
94+
* The CPU cycle counter is a 32-bit counter that increments every CPU cycle
95+
* and overflows quite often. Useful for precision timing.
96+
*
97+
* @return the current CPU cycle count
98+
******************************************************************************/
99+
inline __attribute__((always_inline))
100+
uint32_t getCPUCycleCount()
101+
{
102+
return DWT->CYCCNT;
103+
}
104+
105+
/***************************************************************************//**
106+
* Deinitializes a selected I2C peripheral
107+
*
108+
* @param i2c_peripheral Pointer to the I2C peripheral to be deinitialized
109+
******************************************************************************/
90110
void I2C_Deinit(I2C_TypeDef* i2c_peripheral);
91111

92-
#endif // SILABS_ADDITIONAL_H
112+
#endif // SILABS_ADDITIONAL_H

cores/silabs/wiring_analog.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ int analogRead(pin_size_t pin)
3939

4040
int analogRead(PinName pin)
4141
{
42-
return (int) ADC.get_sample(pin);
42+
return (int)ADC.get_sample(pin);
4343
}
4444

4545
void analogReference(uint8_t reference)
@@ -130,3 +130,8 @@ void analogWriteResolution(int resolution)
130130
DAC_1.set_write_resolution((uint8_t)resolution);
131131
#endif // (NUM_DAC_HW > 1)
132132
}
133+
134+
void analogReadResolution(int resolution)
135+
{
136+
ADC.set_read_resolution((uint8_t)resolution);
137+
}

doc/xiao_mg24.png

40.4 KB
Loading

libraries/ArduinoLowPower/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Arduino Low Power
2-
version=2.1.0
2+
version=2.2.0
33
author=Arduino & Silicon Labs
44
maintainer=Arduino & Silicon Labs
55
sentence=Power saving features for Silicon Labs Arduino boards

libraries/ArduinoLowPower/src/ArduinoLowPower.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,12 @@ void BURTC_IRQHandler(void)
235235
// the device from going to EM4 too quickly. If the device enters EM4 sleep the programmer
236236
// is not able to communicate with it - and without this mechanism it can easily be bricked.
237237
// This function will run before any user code and keep the device awake when the built-in button
238-
// is pressed during startup so that the programmer has a chance to communicate with it.
238+
// (or the configured escape pin) is pressed during startup so that the programmer has a chance to
239+
// communicate with it.
239240
void escape_hatch()
240241
{
241-
#ifndef BTN_BUILTIN
242-
#define BTN_BUILTIN PA0
243-
#endif
244-
245-
pinMode(BTN_BUILTIN, INPUT_PULLUP);
246-
if (digitalRead(BTN_BUILTIN) != LOW) {
242+
pinMode(DEEP_SLEEP_ESCAPE_PIN, INPUT_PULLUP);
243+
if (digitalRead(DEEP_SLEEP_ESCAPE_PIN) != LOW) {
247244
return;
248245
}
249246

libraries/EEPROM/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=EEPROM
2-
version=2.1.0
2+
version=2.2.0
33
author=Arduino
44
maintainer=Arduino <[email protected]>
55
sentence=Enables reading and writing to the permanent board storage.

libraries/Matter/examples/matter_air_quality_sensor/matter_air_quality_sensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- SparkFun Thing Plus MGM240P
1313
- xG24 Explorer Kit
1414
- xG24 Dev Kit
15+
- Seeed Studio XIAO MG24 (Sense)
1516
1617
Author: Hai Nguyen (Silicon Labs)
1718
*/

libraries/Matter/examples/matter_contact_sensor/matter_contact_sensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- SparkFun Thing Plus MGM240P
1313
- xG24 Explorer Kit
1414
- xG24 Dev Kit
15+
- Seeed Studio XIAO MG24 (Sense)
1516
1617
Author: Tamas Jozsi (Silicon Labs)
1718
*/

libraries/Matter/examples/matter_decommission/matter_decommission.ino

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- SparkFun Thing Plus MGM240P
1313
- xG24 Explorer Kit
1414
- xG24 Dev Kit
15+
- Seeed Studio XIAO MG24 (Sense)
1516
1617
Author: Tamas Jozsi (Silicon Labs)
1718
*/
@@ -50,12 +51,14 @@ void setup()
5051

5152
Serial.println("Waiting for Thread network...");
5253
while (!Matter.isDeviceThreadConnected()) {
54+
decommission_handler();
5355
delay(200);
5456
}
5557
Serial.println("Connected to Thread network");
5658

5759
Serial.println("Waiting for Matter device discovery...");
5860
while (!matter_bulb.is_online()) {
61+
decommission_handler();
5962
delay(200);
6063
}
6164
Serial.println("Matter device is now online");

libraries/Matter/examples/matter_door_lock/matter_door_lock.ino

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- SparkFun Thing Plus MGM240P
1313
- xG24 Explorer Kit
1414
- xG24 Dev Kit
15+
- Seeed Studio XIAO MG24 (Sense)
1516
1617
Author: Tamas Jozsi (Silicon Labs)
1718
*/

libraries/Matter/examples/matter_fan/matter_fan.ino

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- SparkFun Thing Plus MGM240P
1212
- xG24 Explorer Kit
1313
- xG24 Dev Kit
14+
- Seeed Studio XIAO MG24 (Sense)
1415
1516
Author: Tamas Jozsi (Silicon Labs)
1617
*/

libraries/Matter/examples/matter_flow_sensor/matter_flow_sensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- SparkFun Thing Plus MGM240P
1212
- xG24 Explorer Kit
1313
- xG24 Dev Kit
14+
- Seeed Studio XIAO MG24 (Sense)
1415
1516
Author: Tamas Jozsi (Silicon Labs)
1617
*/

libraries/Matter/examples/matter_humidity_sensor/matter_humidity_sensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- SparkFun Thing Plus MGM240P
1212
- xG24 Explorer Kit
1313
- xG24 Dev Kit
14+
- Seeed Studio XIAO MG24 (Sense)
1415
1516
Author: Tamas Jozsi (Silicon Labs)
1617
*/

libraries/Matter/examples/matter_illuminance_sensor/matter_illuminance_sensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- SparkFun Thing Plus MGM240P
1212
- xG24 Explorer Kit
1313
- xG24 Dev Kit
14+
- Seeed Studio XIAO MG24 (Sense)
1415
1516
Author: Tamas Jozsi (Silicon Labs)
1617
*/

libraries/Matter/examples/matter_lightbulb/matter_lightbulb.ino

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- SparkFun Thing Plus MGM240P
1212
- xG24 Explorer Kit
1313
- xG24 Dev Kit
14+
- Seeed Studio XIAO MG24 (Sense)
1415
1516
Author: Tamas Jozsi (Silicon Labs)
1617
*/

libraries/Matter/examples/matter_lightbulb_callback/matter_lightbulb_callback.ino

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- SparkFun Thing Plus MGM240P
1515
- xG24 Explorer Kit
1616
- xG24 Dev Kit
17+
- Seeed Studio XIAO MG24 (Sense)
1718
1819
Author: Tamas Jozsi (Silicon Labs)
1920
*/

libraries/Matter/examples/matter_lightbulb_color/matter_lightbulb_color.ino

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- SparkFun Thing Plus MGM240P
1414
- xG24 Explorer Kit
1515
- xG24 Dev Kit
16+
- Seeed Studio XIAO MG24 (Sense)
1617
1718
Author: Tamas Jozsi (Silicon Labs)
1819
*/

libraries/Matter/examples/matter_lightbulb_custom_name/matter_lightbulb_custom_name.ino

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- SparkFun Thing Plus MGM240P
1717
- xG24 Explorer Kit
1818
- xG24 Dev Kit
19+
- Seeed Studio XIAO MG24 (Sense)
1920
2021
Author: Tamas Jozsi (Silicon Labs)
2122
*/

libraries/Matter/examples/matter_lightbulb_dimmable/matter_lightbulb_dimmable.ino

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- SparkFun Thing Plus MGM240P
1313
- xG24 Explorer Kit
1414
- xG24 Dev Kit
15+
- Seeed Studio XIAO MG24 (Sense)
1516
1617
Author: Tamas Jozsi (Silicon Labs)
1718
*/

libraries/Matter/examples/matter_lightbulb_dimmable_multiple/matter_lightbulb_dimmable_multiple.ino

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- SparkFun Thing Plus MGM240P
1313
- xG24 Explorer Kit
1414
- xG24 Dev Kit
15+
- Seeed Studio XIAO MG24 (Sense)
1516
1617
Author: Tamas Jozsi (Silicon Labs)
1718
*/

libraries/Matter/examples/matter_lightbulb_identify/matter_lightbulb_identify.ino

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- SparkFun Thing Plus MGM240P
1313
- xG24 Explorer Kit
1414
- xG24 Dev Kit
15+
- Seeed Studio XIAO MG24 (Sense)
1516
1617
Author: Tamas Jozsi (Silicon Labs)
1718
*/

0 commit comments

Comments
 (0)