diff --git a/stmhal/accel.c b/stmhal/accel.c
index f4fd5469bd9fb23b47f592742d77905bbbacbb02..c77ec5c51193ecdacfe4f106fb6186da143461c1 100644
--- a/stmhal/accel.c
+++ b/stmhal/accel.c
@@ -76,9 +76,7 @@ STATIC pyb_accel_obj_t pyb_accel_obj;
 
 STATIC mp_obj_t pyb_accel_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
     // check arguments
-    if (!(n_args == 0 && n_kw == 0)) {
-        nlr_jump(mp_obj_new_exception_msg(&mp_type_ValueError, "Accel accepts no arguments"));
-    }
+    rt_check_nargs(n_args, 0, 0, n_kw, false);
 
     // init accel object
     pyb_accel_obj.base.type = &pyb_accel_type;
diff --git a/stmhal/adc.c b/stmhal/adc.c
index f05e7823dd4f4a57314db14fd51e90f5318a5eb7..d28392c89450c5d5ea1d70f0bbe2815fdea2afce 100644
--- a/stmhal/adc.c
+++ b/stmhal/adc.c
@@ -8,6 +8,7 @@
 #include "qstr.h"
 #include "obj.h"
 #include "map.h"
+#include "runtime.h"
 #include "adc.h"
 #include "pin.h"
 #include "build/pins.h"
@@ -118,9 +119,7 @@ STATIC void adc_print(void (*print)(void *env, const char *fmt, ...), void *env,
 
 STATIC mp_obj_t adc_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
     // check number of arguments
-    if (!(n_args == 1 && n_kw == 0)) {
-        nlr_jump(mp_obj_new_exception_msg(&mp_type_ValueError, "ADC accepts 1 argument"));
-    }
+    rt_check_nargs(n_args, 1, 1, n_kw, false);
 
     // 1st argument is the pin name
     mp_obj_t pin_obj = args[0];
diff --git a/stmhal/dac.c b/stmhal/dac.c
index caf8beeecbc45e2bf559a2cab96422ec2625462d..8bbab35be9f18f55559d0b2c255255d425e016df 100644
--- a/stmhal/dac.c
+++ b/stmhal/dac.c
@@ -65,9 +65,7 @@ STATIC pyb_dac_obj_t pyb_dac_channel_2 = {{&pyb_dac_type}, DAC_CHANNEL_2, DMA1_S
 
 STATIC mp_obj_t pyb_dac_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
     // check arguments
-    if (!(n_args == 1 && n_kw == 0)) {
-        nlr_jump(mp_obj_new_exception_msg(&mp_type_ValueError, "Dac accepts 1 argument"));
-    }
+    rt_check_nargs(n_args, 1, 1, n_kw, false);
 
     machine_int_t dac_id = mp_obj_get_int(args[0]);
     uint32_t pin;
diff --git a/stmhal/exti.c b/stmhal/exti.c
index 384691c916ce92a920692319eb71006104f66abb..c5378d835e19a17f9f6840541af812520e08c190 100644
--- a/stmhal/exti.c
+++ b/stmhal/exti.c
@@ -262,7 +262,7 @@ STATIC MP_DEFINE_CONST_DICT(exti_locals_dict, exti_locals_dict_table);
 STATIC mp_obj_t exti_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
     // type_in == exti_obj_type
 
-    rt_check_nargs(n_args, 4, 4, n_kw, 0);
+    rt_check_nargs(n_args, 4, 4, n_kw, false);
 
     exti_obj_t *self = m_new_obj(exti_obj_t);
     self->base.type = type_in;
diff --git a/stmhal/i2c.c b/stmhal/i2c.c
index 9bf7799f4066b5fed852a9b70bb8568446decd18..9556e32c9c00d5495ca1b84fa55605f51d106e74 100644
--- a/stmhal/i2c.c
+++ b/stmhal/i2c.c
@@ -80,9 +80,7 @@ STATIC pyb_i2c_obj_t pyb_i2c_obj[PYB_NUM_I2C] = {{{&pyb_i2c_type}, &I2cHandle_X}
 
 STATIC mp_obj_t pyb_i2c_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
     // check arguments
-    if (!(n_args == 1 && n_kw == 0)) {
-        nlr_jump(mp_obj_new_exception_msg(&mp_type_ValueError, "I2C accepts 1 argument"));
-    }
+    rt_check_nargs(n_args, 1, 1, n_kw, false);
 
     // get i2c number
     machine_int_t i2c_id = mp_obj_get_int(args[0]) - 1;
diff --git a/stmhal/led.c b/stmhal/led.c
index 13dc81d18ebd466fc273d564e7ef2e472c24df15..557f54538e06ebe9a6f2fa8c6f3358132c55249d 100644
--- a/stmhal/led.c
+++ b/stmhal/led.c
@@ -208,9 +208,7 @@ void led_obj_print(void (*print)(void *env, const char *fmt, ...), void *env, mp
 
 STATIC mp_obj_t led_obj_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
     // check arguments
-    if (!(n_args == 1 && n_kw == 0)) {
-        nlr_jump(mp_obj_new_exception_msg(&mp_type_ValueError, "Led accepts 1 argument"));
-    }
+    rt_check_nargs(n_args, 1, 1, n_kw, false);
 
     // get led number
     machine_int_t led_id = mp_obj_get_int(args[0]) - 1;
diff --git a/stmhal/servo.c b/stmhal/servo.c
index ad33db75c242cca09d2025855240d8839d9546b1..5955328580882319e5820068cd66f2b67bb31cd5 100644
--- a/stmhal/servo.c
+++ b/stmhal/servo.c
@@ -8,6 +8,7 @@
 #include "qstr.h"
 #include "obj.h"
 #include "map.h"
+#include "runtime.h"
 #include "servo.h"
 
 // this servo driver uses hardware PWM to drive servos on PA0, PA1, PA2, PA3 = X1, X2, X3, X4
@@ -156,9 +157,7 @@ STATIC void pyb_servo_print(void (*print)(void *env, const char *fmt, ...), void
 
 STATIC mp_obj_t pyb_servo_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
     // check arguments
-    if (!(n_args == 1 && n_kw == 0)) {
-        nlr_jump(mp_obj_new_exception_msg(&mp_type_ValueError, "Servo accepts 1 argument"));
-    }
+    rt_check_nargs(n_args, 1, 1, n_kw, false);
 
     // get servo number
     machine_int_t servo_id = mp_obj_get_int(args[0]) - 1;