Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Peripheral Pin Select in dsPIC33

Status
Not open for further replies.

poorchava

Advanced Member level 1
Joined
May 21, 2009
Messages
429
Helped
71
Reputation
142
Reaction score
71
Trophy points
1,318
Location
Wrocław, Poland
Activity points
4,780
I'm programming a controller board which has dsPIC33FJ128MC804. This MCU has 2 SPI modules. I need to communicate with 3 devices: Display (write only), serial flash (write/read) and Sensor Analog Frontend LMP90099 from NSc (write/read).

Frontend needs communication all the time, but flash and display only once in a while. First i thought that i will use second spi module for flash and bit-bang the display driver. On the second thought it might be possible to use one SPI port for communication with both display and flash, only switching Peripheral Pin Select Registers.

Did anyone do something like that? Are there any pitfalls or things u need to watch out for? PPS seems to be documented quite poorly at Microchip documents (including FRMs)
 

I have used PPS to enable a PIC24FJ64GB002 which has 2 UARTs to switch between four serial devices, e.g. PC, GSM modem, GPS modem and bluetooth using commands such as
Code:
    _RP3R = 5;					// for UART2 Rx and Tx
    _U2RXR = 2;
	UART2Init();				// initialise UART2
or
Code:
#include <pps.h>
   iPPSOutput(U2txPin, OUT_FN_PPS_U2TX);      // TXD
   iPPSInput (IN_FN_PPS_U2RX, U2rxPin);       // RXD
   UART2Init();				// initialise UART2
not tried it with SPI interfaces but I don't see why it should not work, make sure you open and close the devices correctly between switching.

Alternativly you could connect all the devices as slaves to a single SPI with the dsPIC as the master (assuming they all use the same clock polarity and phase)
 
Last edited:

I think i can actually switch between those devices without changing SPI settings, because both flash and display driver can operate with 5MHz speed in mode 0,0. Chip selects are separate, so if i bring a CS for one device high it shouldn't react to anything i send to the other device.

Also, i've come with idea of connecting multiple devices to single bus, but it was after i've ordered the board so such change isn't very much cost effective.
 

PPS seems to be documented quite poorly at Microchip documents (including FRMs)
What's your particular problem with PPS? The functionality is completely documented in datasheet paragraph 11.6 There's no restriction in switching PPS on the fly, you can also connect multiple outputs to the same peripheral function if it serves a purpose. These properties can be easily derived from the datasheet, I think.
Also, i've come with idea of connecting multiple devices to single bus
Yes, that's the usual way to go. Possibly SPI mode must be switched between accesses.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top