@@ -221,6 +221,30 @@ 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
+ rv = spi_transceive_dt (& spim_valid , tdata .stx_set , tdata .srx_set );
240
+ zassert_equal (rv , 0 , "Got %d instead" , rv );
241
+
242
+ /* use different config structure - force reconfiguration and thus report error */
243
+ spim_invalid .config .frequency = 124999 ;
244
+ rv = spi_transceive_dt (& spim_invalid , tdata .stx_set , tdata .srx_set );
245
+ zassert_equal (rv , - EINVAL , "Got %d instead" , rv );
246
+ }
247
+
224
248
static void before (void * not_used )
225
249
{
226
250
ARG_UNUSED (not_used );
0 commit comments