• AVR Freaks

Hot!SPI in interrupt mode

Author
CarpeCimex
Starting Member
  • Total Posts : 46
  • Reward points : 0
  • Joined: 2012/04/05 18:24:34
  • Location: 0
  • Status: offline
2020/04/15 09:28:06 (permalink)
0

SPI in interrupt mode

I have MPLAB 5.3, MCC 3.95.0, and peripheral library 1.166.0.  My target device is a dsPIC33CK256MP203.
 
When I configure the SPI module I get a warning "MCC does not support SPI in Interrupt Mode", and no code is generated for handling interrupts.  Unfortunately, I need to use SPI in interrupt mode.  Specifically, my SPI operates as an 8-bit slave and I want an interrupt when a byte is received. 
 
When I look at interrupts created by MCC for other modules it's not clear how to manually configure SPI for interrupt operation.  Can anyone help me get started?
 
Thanks,
Gerrit
#1
Aussie Susan
Super Member
  • Total Posts : 3756
  • Reward points : 0
  • Joined: 2008/08/18 22:20:40
  • Location: Melbourne, Australia
  • Status: offline
Re: SPI in interrupt mode 2020/04/15 19:29:29 (permalink)
4 (1)
The SPI module is one of the simpler ones and there a lots of examples around as to how to set things up.
Basically you configure the module - the data sheet is very clear on what the individual bit fields are - including for that device what the interrupt condition(s) is/are - and create the correctly names ISR(s) and let it go.
These newer modules have a lot of additional capability (especially in the audio area) but if you stick the to basics (8 or 16 bit word, not audio stuff, no enhanced buffer etc.) then you can ignore most of the registers.
The data sheet and the FRM have a lot of information about the basic setup and code examples (especially in C in the FRM).
Have a go and come back with questions if you have any issues.
Susan 
#2
Jump to:
© 2020 APG vNext Commercial Version 4.5