Harmony v3 : SPI in slave mode and DMA
I have been using smaller PICs since years, now I need to use PIC32MZ to get more processing power.
I have just installed Harmony v3 (v3.3.0 if I'm not mistaken).
Created new project with PIC32EF starter kit (pic32mz2048efm144 processor).
Project graph opened.
I need three communication channels:
- outgoing master SPI to configure smaller processor that works as signal generator (can't accept jitter in generated signals so this processor works without PLL)
- incoming slave SPI with DMA to accept incoming data from external high-end ADC chip
- outgoing bit bangled data channel that adapts it's work to what I get from ADC
SPI communication from ADC goes through optos as it has separate power supply to get best accuracy. Optos create delays so I pass both clock and data through it, to get similar delays. This means I need to use SPI in slave mode in pic32mz.
So in Project graph I add following components:
- freertos (I'm not usre if I'd need it, but adding core asks me to add an rtos)
- EF starter kit BSP
- SPI driver (set it to 2 instances)
I add a link beetween SPI driver instances and SPIs from peripheral library.
I enable DMA in SPI instance 1, it links automatically to channels 0 and 1.
I open SPI2 (linked with driver instance 1) and... master mode enable bit is forced to: master mode.
How can I switch it to slave mode?