Interrupts and SPI peripherals

Ian0

Joined Aug 7, 2020
9,803
If you provide a bit more detail:
What is the device that produces the hardware interrupts?
What are the other devices from which you need to read?
Part numbers etc.
the someone might work out a solution.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
If you provide a bit more detail:
What is the device that produces the hardware interrupts?
What are the other devices from which you need to read?
Part numbers etc.
the someone might work out a solution.
Hi I0,
As this type of thing crops up occasionally, I hoped to keep it none specific.

One example, that I'm working on uses a Ublox GPS module M9N.
I am trying to get it to talk using SPI, and after long threads like this, so far have failed, but I think it should work if I get it right.
The alternative is to READ it using the UART HW INTERRUPT.
The M9N outputs 'say' 5/sec to the UART.
This would run alongside 4ish SPI peripherals, and the MAIN CODE.

P.S The Ublox D/Ss are pretty long!
C
 

Attachments

Last edited:

Ian0

Joined Aug 7, 2020
9,803
Hi I0,
As this type of thing crops up occasionally, I hoped to keep it none specific.

One example, that I'm working on uses a Ublox GPS module M9N.
I am trying to get it to talk using SPI, and after long threads like this, so far have failed, but I think it should work if I get it right.
The alternative is to READ it using the UART HW INTERRUPT.
The M9N outputs 'say' 5/sec to the UART.
This would run alongside 4ish SPI peripherals, and the MAIN CODE.

P.S The Ublox D/Ss are pretty long!
C
but it doesn’t have an interrupt output???
 

Ian0

Joined Aug 7, 2020
9,803
Hi I0,
No, it would be a different routine.
RCREG would be copied to the SW BUFFER ARRAY in turn.
C
I’m not seeing what the problem is.
Just read the data from the GPS using the SPI interface whenever you want to know where you are.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
I’m not seeing what the problem is.
Just read the data from the GPS using the SPI interface whenever you want to know where you are.
Hi I0,
This is an example of a general question!
In this example can the PIC HW INTERRUPT work alongside a number of SW SPI routines, plus MAIN CODE?

Regarding the GPS using SPI, it's not as easy as it seems!
C
 

Ian0

Joined Aug 7, 2020
9,803
Hi I0,
This is an example of a general question!
In this example can the PIC HW INTERRUPT work alongside a number of SW SPI routines, plus MAIN CODE?
Do you mean the UART interrupt? If so, then there is nothing preventing the SPI and UART operating at the same time. The next SPI data read will just be delayed until the UART interrupt service routine has been executed.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Do you mean the UART interrupt? If so, then there is nothing preventing the SPI and UART operating at the same time. The next SPI data read will just be delayed until the UART interrupt service routine has been executed.
Hi I0,
Hurray :)
Onward and upward.

Now I'm thinking about all of those "It can't be done" messages I replied to!
C.
 

Ian0

Joined Aug 7, 2020
9,803
We would have got there sooner had you said you wanted to receive data from the UART! As recently as post #42 you said
“One example, that I'm working on uses a Ublox GPS module M9N.
I am trying to get it to talk using SPI”
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
We would have got there sooner had you said you wanted to receive data from the UART! As recently as post #42 you said
“One example, that I'm working on uses a Ublox GPS module M9N.
I am trying to get it to talk using SPI”
Hi I0,
It would, but that wasn't the question really.
UART is one example of the four or five HW INTERRUPT choices.
I gave the example of the GPS into the PIC HW UART because if I can't get the GPS to be READ via SPI, then this is the other choice, if it is possible, but there will be other times when a different HW INTERRUPT would be chosen.
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
After a days thought, I've come to realise that I already use UART INTERRUPT and SPI in at least one program, which, as anyone who helped or took interest in those programs will know.
It's just my slow progress of learning.
It must be waring to be patient, with this, and I appreciate it.
I just hadn't noticed the similarities between INTERRUPTs of different types.
EDITED

C.
 
Last edited:
Top