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

SPI failure in case of modifications to unrelared code segment

Hi everyone,

I am using nrf52832 with SDK version 11.0 for an IoT application. I am communicating with Atmel ATWINC 1500 module through SPI in order to connect to Wifi. My code was working fine until I added few new lines of code unrelated to SPI. Now when I run the project on Nordic hardware I get following SPI read errors.

(APP)(ERR)[spi_data_read][385][nmi spi]: Failed data response read...(00) (APP)(ERR)[spi_read_reg][625][nmi spi]: Failed data read...

I know that this error occurs when there is some issue with pin assignment for SPI interface but I have verified all the pin assignments. The stranger thing is that the project starts working fine if I comment out any part of the project totally unrelated with SPI. Following are the results when I compile the project using Eclipse.

'C:/Program Files (x86)/GNU Tools ARM Embedded/5.4 2016q3/bin/arm-none-eabi-size' _build/nrf52832_xxaa.out text data bss dec hex filename 56312 1436 37904 95652 175a4 _build/nrf52832_xxaa.out

It might be a memory issue or some other issue. I have tried debugging it but failed so any leads or suggestion about where the problem might be or how to debug such an issue will be highly appreciated. My Make file and start up file is attached.

arm_startup_nrf52.s Makefile

Parents
  • Thanks for the comment Bjorn. Below are few such lines of code. They are there for the recording of signals received on gpio pins and those pins are completely different from SPI pins.

    	//if transmit interrupt has triggered- toggle pins and reset timer
    	if(bus_driver_pins_toggle_flag_volatile == true){
    		//reset the flag which has been set in the ISR
    		bus_driver_pins_toggle_flag_volatile = false;
    		SEGGER_RTT_WriteString(0,"noooooooooooooooooooooooooooooooooooooooooooooooooooo\n\r\n\r\n\r\n\r\n\r\n\r");
    
    		vBus_Pin_Toggle_Handler(); // Uses the hard coded pulse times
    		//vBus_Pin_Toggle_Handler_Recorded(); // Uses the real measured pulse times
    	}
    
    	//if comparator interrupt has triggered - do time measurement
    	if(bus_driver_comparator_flag_volatile == true){
    
    		vBus_Pulse_Time_Measurment_Handler();
    	}
    
    	//if time out is detected this means the package has been received.
    	if(bus_driver_time_out_flag_volatile == true){
    		bus_driver_time_out_flag_volatile = false;
    		vDisable_Bell_Signal_Reception();
    		SEGGER_RTT_WriteString(0,"Bus package received\n\r");
    		u32_bell_detected_flag = u32_Check_Bus_Package();
    	}
    

    Also here is another part of code, with same implications,controlling LEDs through pins unrelated to SPI

    		   if ((led_delay_value != 0xFFFFFFFF) & (led_delay_value > 0))
    				{
    					led_delay_value --;
    				}
    				status_led_main(calling_argument_for_status_led_main);
    
  • I am assuming that you're initializing the GPIO pins somewhere in the code. Could you comment out all code associated with these pins except the initialization? Does the SPI function properly then?

Reply Children
No Data
Related