@@ -221,6 +221,31 @@ ZTEST(spi_error_cases, test_spis_tx_buf_not_in_ram)
221221 zassert_equal (slave_rv , - ENOTSUP , "Got %d instead" , slave_rv );
222222}
223223
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+
224249static void before (void * not_used )
225250{
226251 ARG_UNUSED (not_used );
0 commit comments