This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF5340-"spi_transceive"cause a bus fault in SPM application

 I  Separate two projects ,SPM application and  non-secure application.the spi driver can work in  non-secure application,when I try to transplant the spi driver in SPM application,a bus fault occured

log:

[00:07:38.250,549] [1;31m<err> os: ***** BUS FAULT *****[0m
[00:07:38.250,579] [1;31m<err> os: Precise data bus error[0m
[00:07:38.250,579] [1;31m<err> os: BFAR Address: 0xd[0m
[00:07:38.250,579] [1;31m<err> os: r0/a1: 0x00000000 r1/a2: 0x00000001 r2/a3: 0x00000141[0m
[00:07:38.250,579] [1;31m<err> os: r3/a4: 0x00001703 r12/ip: 0x00011fb8 r14/lr: 0x200113b0[0m
[00:07:38.250,579] [1;31m<err> os: xpsr: 0x0000a400[0m
[00:07:38.250,579] [1;31m<err> os: Faulting instruction address (r15/pc): 0x00000141[0m
[00:07:38.250,579] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0[0m
[00:07:38.250,610] [1;31m<err> os: Current thread: 0x00000000 (unknown)[0m
[00:07:38.320,861] [1;31m<err> fatal_error: Resetting system[0m

the gpios and spi is initialized before "spm_config()",when run into "spi_transceive",the bus fault occured!  when there is no spi driver ,the SPM application can jump into non-secure application successfully.

SPM main function:
void main(void)
{
uint32_t btl_ret = 0;
NRF_SPIM_Type *test = (NRF_SPIM_Type *)(NRF_SPIM1_S_BASE);
uint32_t *test1 = NULL;
uint32_t *test2 = NULL;
uint32_t *test3 = NULL;

if (iseem_fs_init(false))
iseem_log_info("init iseem fs failed");
user_ta_appending();
printk("ta start up\r\n");
board_pin_init();
spi_init();
sensor_hw_reset();

bf_spi_write(1);
// btl_ret = btl_sensor_init();
spm_config();
spm_jump();
while(1);
}

"bf_spi_write(1)"  calls "spi_transceive()",when run into spi_transceive,the bus fault occured!

Parents Reply Children
No Data
Related