SPI - SDI pin really available?

Status
Not open for further replies.

atferrari

Well-Known Member
Most Helpful Member
DOUBT SOLVED: see my last post below.

PIC 18F family - Assembler.

I implemented the addressing / data buses to write / read an EEPROM using a string of 74HC595 shift registers. It worked OK.

When implemented a more "adult" version with just IO pins from a 18F4520, started to get massive (but consistent) errors.

Since I peek at the data through a 74HC595 shift register driven by the SPI module (Master mode), I need to discard this doubt:

Is the SDI pin really available to me? If so, just as an output, right?

After burning my last 18F4520 (yes, I still do things like that) I am going back to the 18F452 (have plenty around).

Please read the excerpt from its datasheet (same wording as for the the late 18F4520).

Just in case, while I know that the /SS TRIS position is WRONG, that pin is not relevant here because the SPI is Master.

Any comment appreciated.


 
Last edited:
My question refers to the eventual availability of the SDI pin.

Let's say that the basics in using SPI, I know them.
 
Take a look at Table 1-2, this shows that RC4 is available for digital I/O when the MSSP module is not used. In I2C mode it is used as the data pin which is bidirectional, so it is definitely available as both an input or an output.

Ensure that SSPCON1.SSPEN is set to 0 to disable the MSSP module, then pin RC4 is available for I/O. With SSPEN set to 0 the normal TRIS register controls input or output.

You might like to check the errata for the device, there are quite a number of items depending on which silicon revision you are using.
 
Hola Edeca,

My design is working properly now so I think it is the moment to test if SDI is available as OUT pin, setting its respective TRIS =0.

I am writing / reading a SST29EE020 EEPROM. Data writes / reads like a charm. Nice!

There were too many wrong things beside the design, like a protoboard with bad contacts. Now, it works OK.

Not easy debugging things without even a single pin to flash a LED or put some signal in the scope.

Working with the 18F4520 again because I forgot that the 18F452 had that horrible RA4 open collector.

I will post the outcome.
 
Edeca, hola again,

Doubt solved: as the datasheet says, if I make TRISC,4 =0, when SSPCON1,SSPEN =1, the pin IS available as an output.

Thanks for your time.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…