This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

using SSI on Hercules

Other Parts Discussed in Thread: HALCOGEN

Hi

I want to use a software interrupt and call it at the end of another higher priority interrupt but I don't see anything related to it on Halcogen. I saw something about writing the "KEY" on the right register but thats all. And I did not find the code for it on notification.c

so I was wondering how to use it...

thanks!!

  • Take a look at section 5.1 of SPNA218. Let me know if that helps.

  • I already look at it but... I don't think is that...

    The Halcogen has the option to activate that interrupt channel bot it does not generate the code for the function so I wanted to know how to do it on the same format as the other interrupt functions...

    thanks!!
  • Are you talking about a software interrupt? It is referred to as SWI or newer ARM documents refer to an SVC (supervisor call). The only thing in HALCoGen is creating the branch in the vector table by enabling SVC in the "Interrupts" tab:

    There is no "KEY" that has to be written. You need to write the software interrupt handler as described in SPNA218.

  • ooooh hahahah okok
    But on the TMR says something about the "KEY"
    I will see this part. You said I only have to copy the code from SPNA218??


    Thanks!!

    update:

    Im talking about the SSI channel which is supposed to be the system software interrupt... I saw that on the TMR

  • look Bob

    Here is that part: 

    But I don't know how to set the ssiREG1 to set this

    ssiREG1->SSDATA1=0x75;

    so.... I was wondering how to do that since Halcogen doesn't have the option for the SSI...

    thanks!!

  • OH, sorry, I was thinking of of SWI. The SSI comes in on VIM channel 21. In HALCoGen, you enable the SSI on Channel 21:

    Then in the VIM RAM you create the name of your SSI routine. I used systemSoftwareInt as an example:

    Then you write your own SSI routine.

  • yes yes but how do I enable the interrupt and call it? because I need to write the key on the register but I have no idea on how to do that, since the register doesnt appear anywhere...
    thanks!!!
  • It would look something like this:

    	systemREG1->SSISR1 = (0x7500 | (0xFF & data1 ));
    	systemREG1->SSISR2 = (0x8400 | (0xFF & data2 ));
    	systemREG1->SSISR3 = (0x9300 | (0xFF & data3 ));
    	systemREG1->SSISR4 = (0xA200 | (0xFF & data4 ));
    

    Make sure you include "system.h". The values data1 through data4 can be variables or constants.

  • ooooh okokok 

    So I just have to call 

    systemREG1->SSISR1 = (0x7500 | (0xFF & data1 ));

    to enter the interrupt code??

    or how would it work?? 

    why the or with FF? and the value of dataX matters??

    thanks!!!

  • Yes, executing that line of code will generate an SSI interrupt request. Your SSI interrupt service routine should then read the SSIVEC register to identify which SSI was generated (1..4). Bits [15:8] of the SSIVEC register will contain the 8 bit value of "datax". This is like an 8 bit argument passed to the interrupt routine. You don't need to use it if you don't want to. However, it must be only 8 bits, that is why the "and" with 0xFF.
  • mmmm so dataX is the identification number for that SSI right?
    dataX and the SSIVEC must correspond to the same SSI right??
    thanks!!
  • For example, this line invokes SSI 3, with SSDATA =5;

    	systemREG1->SSISR3 = (0x9300 | (0xFF & 5 ));
    

    In the interrupt service routine, the read of SSIVEC gives 0x0503. The 0x03 means it was from SSI3. The 0x05 is the data byte from SSDATA.

  • mmmmm ok ok so I first write the key and then he data is just a number that matters?? or is just a number??

    and how do I call the function?? or I use the one given on the sys_vim.h??
  • I meant.... how do I do for the interrupt function to enters and that?? like the interrupt routine of gio.c
    I don't know if im clear... :S

    thanks!!
  • Sorry, I do not understand your question. Are you asking how to write the SSI interrupt service routine, the routine that is executed after the interrupt caused by writing the SSIRx register?
  • Yes, the data is just a number that the interrupt routine can use. It is an interrupt, you don't actually call the routine. When you write the key, the system hardware generates an interrupt to the CPU. The CPU stops executing code (probably a few instructions past the write of the key) and jumps to the interrupt service routine identified by the name you put in the VIMRAM. At the end of the interrupt routine, the CPU returns to where it left off and resumes executing the original code.
  • So Data is just whatever number I want, which is not important for getting the interrupt right? But I could use th resultant value to do an IF if Im using the 4 software interrupts right?

    BTW I already got the interrupt working =)

    Thanks a lot Bob!!!
  • Yes, that is correct.
  • Hi Bob
    Hope you're doing great
    I already had everything working, thanks to your help, but for some reason when the interrupt ends, the system gets a reset :/ you have any idea of what can I do to avoid that?
    Thanks!!
  • Are you sure it is a reset, not an abort? Can you read the System Exception Status Register after the reset, but before your code clears it, and tell what caused the reset?
  • ammmmm yes... something weird is happening. Once the GIO is disabled, the SSI process all the data and then reactivates the GIO interrupt but is not occurring. I did a change. Instead of disabling the GIO interrupt on GIO notification, I disable it once Im inside the SSI interrupt. But, at the end of the SSI, I enable the GIO again but nothing happens.... It never reaches again...
  • mmm Its weird. Even after Taking out the "disable" line, the problem persisted. The MCU resets or never enters again to GIO interrupt... 

    		sampling_muscle++;
    		if(sampling_muscle>X)	//sampling the muscle data from ADS1271, taking 1 sample every 10 counts
    		{
    			spiInit();
    
    			spiDAT1_t dataconfig1_t;
    			//Check spi.h lines 116 and 56
    			dataconfig1_t.CS_HOLD = FALSE;
    			dataconfig1_t.WDEL    = 0;
    			dataconfig1_t.DFSEL   = SPI_FMT_0;
    			dataconfig1_t.CSNR    = SPI_CS_NONE;
    			spiReceiveData(spiREG5, &dataconfig1_t, 2, RX_Data_Master);
    
    
    			//convert the data from ADC SD to float from 0 to 3.3V
    			muscle_data[m_count]=((((float32_t)((uint32)RX_Data_Master[0]<<12 |(uint32)RX_Data_Master[1]))/0x00FFFFFF)*3.3);
    
    			m_count++;
    
    			if(m_count>5149)
    				{
    				
    					m_count=0;
    					done_muscle_data=1;
    					if(inicialization_done==1)// && done_muscle_data==1)
    					{
    
    						ss_interrupt=data1;
    						systemREG1->SSISR1 = (0x7500 | (0xFF & data1 ));
    
    					}
    				}	//if(m_count>999)*/
    			sampling_muscle=0;

    This code is the one on the gio notification. 

    And here is the one (without the important parts) of the SSI

    if(ss_interrupt==data1)
    	{
    		
    		//gioDisableNotification(gioPORTB,2);
    		//_disable_IRQ();
    		//Do FIR filter to the signal
    		//linREG->PIO3=(uint32)2;	//LIN_RX
    		FIR_520();
    
    
    		//check if the received signal was just a pulse
    		//signal_pulse();
    		time_signal();
    
    		if(fir_done==1 )//&& muscle_data_prom>1.8 && signal_time>20 ) // && arm_pulse==0)
    		{ //doing FFT here with the data obtained from SPI
    	
    			}
    
    			
    			
    
    
    
    
    			
    
    		}//if(muscle_data_prom>1.0 && fir_done==1)
    
    
    	}//signal processing
    
    	
    
    	//gioEnableNotification(gioPORTB,2);
    	done_processing=1;
    }

    As you can see, I commented the lines about the interrupts but... the problem persisted... Im not sure of whats going on... 

    EDIT

    The problem seems to be on the GIOB interrupt... for some reason it never enters again after the processing... Don't know what am I missing.... The idea of disabling the interrupt is for the processing of the data doesnt have an interrupt. At least not one coming from the SPI because the data could get replaced. So I decided to disable the GIO interrupts while doing the processing and reactivate it after its done... 

  • I could solve it.... just added uint32 offset = systemREG1->SSIVEC; at the start of the SSI routine and problem solved...