Tony Kübek, Flintab AB says:
According to the data for the F876, regarding the SPI module I paraphrase ( DS30292-A page 66 ):" - SDI is automatically controlled by the SPI module "Then after the table it states:
"Any serial port function that is not desired may be overridden by programming ;*** WARNING: TRIS expanded in two instructions. Check if previous instruction is a skip instruction. ; the ....TRIS register to the opposite value"I just spent 3 hour tracking down the obvious bug of setting the SDI as an output ( as I only read the first paragraph ). Is it only me ( I'm not native English ) but aren't these statements actually wrong ? ( they opposite each other ).
Anyway, if anyone cares here the lesson: ALWAYS ( exept UART TX/RX ;-) ) set the pin they way you will use it, i.e. outputs ( ex. SDO ) should have ;*** WARNING: TRIS expanded in two instructions. Check if previous instruction is a skip instruction.TRIS registers are accessed by MOV !Rx, W (M = $0F or $1F). ; TRIS bit cleared, inputs ( ex. SDI ) should have TRIS bit set.