Skip to content

Commit

Permalink
Release 2.2.0 (#152)
Browse files Browse the repository at this point in the history
* 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 <l.cavagnis@arduino.cc>
Co-authored-by: Martino Facchin <m.facchin@arduino.cc>
Co-authored-by: Christopher Méndez <49886387+mcmchris@users.noreply.github.com>
  • Loading branch information
4 people authored Nov 29, 2024
1 parent 9bff82c commit b049267
Show file tree
Hide file tree
Showing 3,186 changed files with 1,174,306 additions and 716 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
137 changes: 137 additions & 0 deletions boards.txt

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cores/silabs/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void analogReferenceDAC(uint8_t reference);
typedef enum _dac_channel_t dac_channel_t;
void analogWrite(dac_channel_t dac_channel, int value);
void analogWriteResolution(int resolution);
void analogReadResolution(int resolution);

bool get_system_init_finished();
uint32_t get_system_reset_cause();
Expand Down
2 changes: 1 addition & 1 deletion cores/silabs/Serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ UARTClass::UARTClass(sl_iostream_t* stream,
void(*deinit_fn)(void),
void(*serial_event_fn)(void)) :
serial_mutex(nullptr),
initialized(true),
initialized(false),
baudrate(115200),
suspended(false)
{
Expand Down
13 changes: 13 additions & 0 deletions cores/silabs/adc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ AdcClass::AdcClass() :
initialized(false),
current_adc_pin(PD2),
current_adc_reference(AR_VDD),
current_read_resolution(this->max_read_resolution_bits),
adc_mutex(nullptr)
{
this->adc_mutex = xSemaphoreCreateMutexStatic(&this->adc_mutex_buf);
Expand Down Expand Up @@ -147,6 +148,10 @@ uint16_t AdcClass::get_sample(PinName pin)
uint16_t result = IADC_readSingleData(IADC0);

xSemaphoreGive(this->adc_mutex);

// Apply the configured read resolution
result = result >> (this->max_read_resolution_bits - this->current_read_resolution);

return result;
}

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

void AdcClass::set_read_resolution(uint8_t resolution) {
if (resolution > this->max_read_resolution_bits) {
this->current_read_resolution = this->max_read_resolution_bits;
return;
}
this->current_read_resolution = resolution;
}

const IADC_PosInput_t AdcClass::GPIO_to_ADC_pin_map[64] = {
// Port A
iadcPosInputPortAPin0,
Expand Down
11 changes: 11 additions & 0 deletions cores/silabs/adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ class AdcClass {
******************************************************************************/
void set_reference(uint8_t reference);

/***************************************************************************//**
* Sets the ADC read resolution
*
* @param[in] resolution The selected read resolution in bits
******************************************************************************/
void set_read_resolution(uint8_t resolution);

// The maximum read resolution of the ADC
static const uint8_t max_read_resolution_bits = 12u;

private:
/***************************************************************************//**
* Initializes the ADC hardware
Expand All @@ -80,6 +90,7 @@ class AdcClass {
bool initialized;
PinName current_adc_pin;
uint8_t current_adc_reference;
uint8_t current_read_resolution;
static const IADC_PosInput_t GPIO_to_ADC_pin_map[64];

SemaphoreHandle_t adc_mutex;
Expand Down
48 changes: 32 additions & 16 deletions cores/silabs/silabs_additional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <cstdio>
#include "silabs_additional.h"
#include "arduino_i2c_config.h"
extern "C" {
#include "em_emu.h"
#include "em_cmu.h"
Expand Down Expand Up @@ -66,6 +67,19 @@ String getCoreVersion()
return String(ARDUINO_SILABS);
}

// DPLL config for 78 MHz CPU clock - Matter variants default to this
#define DPLL_HFXO_TO_78MHZ \
{ \
78000000, /* Target frequency */ \
3839, /* Factor N */ \
1919, /* Factor M */ \
cmuSelect_HFXO, /* Select HFXO as reference clock */ \
cmuDPLLEdgeSel_Fall, /* Select falling edge of ref clock */ \
cmuDPLLLockMode_Phase, /* Use frequency lock mode */ \
true, /* Enable automatic lock recovery */ \
false /* Don't enable dither function */ \
}

void setCPUClock(cpu_clock_t clock)
{
CMU_DPLLInit_TypeDef pll_init;
Expand All @@ -76,6 +90,9 @@ void setCPUClock(cpu_clock_t clock)
case CPU_76MHZ:
pll_init = CMU_DPLL_HFXO_TO_76_8MHZ;
break;
case CPU_78MHZ:
pll_init = DPLL_HFXO_TO_78MHZ;
break;
case CPU_80MHZ:
pll_init = CMU_DPLL_HFXO_TO_80MHZ;
break;
Expand All @@ -95,7 +112,8 @@ uint32_t getCPUClock()
return SystemCoreClockGet();
}

void I2C_Deinit(I2C_TypeDef* i2c_peripheral) {
void I2C_Deinit(I2C_TypeDef* i2c_peripheral)
{
I2C_Reset(i2c_peripheral);

// Reset the I2C to GPIO peripheral routing to enable the pins to function as GPIO
Expand All @@ -104,36 +122,34 @@ void I2C_Deinit(I2C_TypeDef* i2c_peripheral) {
GPIO->I2CROUTE[0].ROUTEEN = 0;
GPIO->I2CROUTE[0].SCLROUTE = 0;
GPIO->I2CROUTE[0].SDAROUTE = 0;
NVIC_DisableIRQ(I2C0_IRQn);
}
#endif

#if defined(I2C1)
if (i2c_peripheral == I2C1) {
GPIO->I2CROUTE[1].ROUTEEN = 0;
GPIO->I2CROUTE[1].SCLROUTE = 0;
GPIO->I2CROUTE[1].SDAROUTE = 0;
NVIC_DisableIRQ(I2C1_IRQn);
}
#endif

#if defined(I2C2)
if (i2c_peripheral == I2C2) {
GPIO->I2CROUTE[2].ROUTEEN = 0;
GPIO->I2CROUTE[2].SCLROUTE = 0;
GPIO->I2CROUTE[2].SDAROUTE = 0;
NVIC_DisableIRQ(I2C2_IRQn);
}
#endif

#if defined(I2C0)
if (i2c_peripheral == I2C0) {
NVIC_DisableIRQ(I2C0_IRQn);
}
#endif
#if defined(I2C1)
if (i2c_peripheral == I2C1) {
NVIC_DisableIRQ(I2C1_IRQn);
}
#endif
#if defined(I2C2)
if (i2c_peripheral == I2C2) {
NVIC_DisableIRQ(I2C2_IRQn);
}
// Reset the I2C pins to floating input
GPIO_PinModeSet(SL_I2C_SCL_PORT, SL_I2C_SCL_PIN, gpioModeInput, 0);
GPIO_PinModeSet(SL_I2C_SDA_PORT, SL_I2C_SDA_PIN, gpioModeInput, 0);

#if (NUM_HW_I2C > 1)
GPIO_PinModeSet(SL_I2C1_SCL_PORT, SL_I2C1_SCL_PIN, gpioModeInput, 0);
GPIO_PinModeSet(SL_I2C1_SDA_PORT, SL_I2C1_SDA_PIN, gpioModeInput, 0);
#endif
}
}
22 changes: 21 additions & 1 deletion cores/silabs/silabs_additional.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
typedef enum {
CPU_39MHZ,
CPU_76MHZ,
CPU_78MHZ,
CPU_80MHZ
} cpu_clock_t;

Expand Down Expand Up @@ -87,6 +88,25 @@ void setCPUClock(cpu_clock_t clock);
******************************************************************************/
uint32_t getCPUClock();

/***************************************************************************//**
* Gets the current CPU cycle count
*
* The CPU cycle counter is a 32-bit counter that increments every CPU cycle
* and overflows quite often. Useful for precision timing.
*
* @return the current CPU cycle count
******************************************************************************/
inline __attribute__((always_inline))
uint32_t getCPUCycleCount()
{
return DWT->CYCCNT;
}

/***************************************************************************//**
* Deinitializes a selected I2C peripheral
*
* @param i2c_peripheral Pointer to the I2C peripheral to be deinitialized
******************************************************************************/
void I2C_Deinit(I2C_TypeDef* i2c_peripheral);

#endif // SILABS_ADDITIONAL_H
#endif // SILABS_ADDITIONAL_H
7 changes: 6 additions & 1 deletion cores/silabs/wiring_analog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int analogRead(pin_size_t pin)

int analogRead(PinName pin)
{
return (int) ADC.get_sample(pin);
return (int)ADC.get_sample(pin);
}

void analogReference(uint8_t reference)
Expand Down Expand Up @@ -130,3 +130,8 @@ void analogWriteResolution(int resolution)
DAC_1.set_write_resolution((uint8_t)resolution);
#endif // (NUM_DAC_HW > 1)
}

void analogReadResolution(int resolution)
{
ADC.set_read_resolution((uint8_t)resolution);
}
Binary file added doc/xiao_mg24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion libraries/ArduinoLowPower/library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Arduino Low Power
version=2.1.0
version=2.2.0
author=Arduino & Silicon Labs
maintainer=Arduino & Silicon Labs
sentence=Power saving features for Silicon Labs Arduino boards
Expand Down
11 changes: 4 additions & 7 deletions libraries/ArduinoLowPower/src/ArduinoLowPower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,12 @@ void BURTC_IRQHandler(void)
// the device from going to EM4 too quickly. If the device enters EM4 sleep the programmer
// is not able to communicate with it - and without this mechanism it can easily be bricked.
// This function will run before any user code and keep the device awake when the built-in button
// is pressed during startup so that the programmer has a chance to communicate with it.
// (or the configured escape pin) is pressed during startup so that the programmer has a chance to
// communicate with it.
void escape_hatch()
{
#ifndef BTN_BUILTIN
#define BTN_BUILTIN PA0
#endif

pinMode(BTN_BUILTIN, INPUT_PULLUP);
if (digitalRead(BTN_BUILTIN) != LOW) {
pinMode(DEEP_SLEEP_ESCAPE_PIN, INPUT_PULLUP);
if (digitalRead(DEEP_SLEEP_ESCAPE_PIN) != LOW) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/EEPROM/library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=EEPROM
version=2.1.0
version=2.2.0
author=Arduino
maintainer=Arduino <info@arduino.cc>
sentence=Enables reading and writing to the permanent board storage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Hai Nguyen (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down Expand Up @@ -50,12 +51,14 @@ void setup()

Serial.println("Waiting for Thread network...");
while (!Matter.isDeviceThreadConnected()) {
decommission_handler();
delay(200);
}
Serial.println("Connected to Thread network");

Serial.println("Waiting for Matter device discovery...");
while (!matter_bulb.is_online()) {
decommission_handler();
delay(200);
}
Serial.println("Matter device is now online");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
1 change: 1 addition & 0 deletions libraries/Matter/examples/matter_fan/matter_fan.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- SparkFun Thing Plus MGM240P
- xG24 Explorer Kit
- xG24 Dev Kit
- Seeed Studio XIAO MG24 (Sense)
Author: Tamas Jozsi (Silicon Labs)
*/
Expand Down
Loading

0 comments on commit b049267

Please sign in to comment.