@@ -221,6 +221,31 @@ ZTEST(spi_error_cases, test_spis_tx_buf_not_in_ram)
221
221
zassert_equal (slave_rv , - ENOTSUP , "Got %d instead" , slave_rv );
222
222
}
223
223
224
+ ZTEST (spi_error_cases , test_no_configure_in_each_transceive )
225
+ {
226
+ int rv ;
227
+ struct spi_dt_spec spim_valid = spim ;
228
+ struct spi_dt_spec spim_invalid = spim ;
229
+
230
+ /* configure device during first transceive with valid config */
231
+ rv = spi_transceive_dt (& spim_valid , tdata .stx_set , tdata .srx_set );
232
+ zassert_equal (rv , 0 , "Got %d instead" , rv );
233
+
234
+ /* change valid config frequency to invalid value */
235
+ spim_valid .config .frequency = 124999 ;
236
+
237
+ /* make sure device is not reconfigured because conf structure pointer is the same
238
+ * thus do not report error because of invalid frequency setting
239
+ */
240
+ rv = spi_transceive_dt (& spim_valid , tdata .stx_set , tdata .srx_set );
241
+ zassert_equal (rv , 0 , "Got %d instead" , rv );
242
+
243
+ /* use different config structure - force reconfiguration and thus report error */
244
+ spim_invalid .config .frequency = 124999 ;
245
+ rv = spi_transceive_dt (& spim_invalid , tdata .stx_set , tdata .srx_set );
246
+ zassert_equal (rv , - EINVAL , "Got %d instead" , rv );
247
+ }
248
+
224
249
static void before (void * not_used )
225
250
{
226
251
ARG_UNUSED (not_used );
0 commit comments