Port B on 6700

I have a question on port B. I am trying to set PB0 as an output. The following code is to set PB0 to output:


And I try to toggle it by:
BitWrPortI(PBDR, &PBDRShadow, 0, 0);
BitWrPortI(PBDR, &PBDRShadow, 1, 0);

However, PB0 does not toggle. Do I need set PB0CR to set a pull up resistor to PB0? If yes, what is the shadow register for PB0CR?


I’m pretty sure the issue here is that the RCM6700 uses PB0 as the SPI clock on serial port B. That’s a shared SPI clock with the serial flash on the device, along with any other SPI devices that you choose to put on the bus.

Try using another pin for your tests (PB1 to PB7). If you MUST use PB0, you’ll have to change SBCR and you’ll lose access to the serial flash and UserBlock storage areas.

And regarding PB0CR, since it’s only for a single bit you don’t need a shadow register. The shadow registers are for byte-wide registers where you only need to change some of the bits, and need to preserve the other bits’ values.

I added WrPortI(SBCR, &SBCRShadow, 0x00); to disable the clocked serial mode. Then PB0 can be set high/low with no problem.

However, I found that if readUserBlock() or writeUserBlock() is ran, then PB0 is not working again (PB0 stay in the same state and have no response of BitWrPortI(PBDR, &PBDRShadow, 0, 0); and BitWrPortI(PBDR, &PBDRShadow, 1, 0);).

If I disable the clocked serial mode again after readUserBlock() or writeUserBlock() with WrPortI(SBCR, &SBCRShadow, 0x00);, then PB0 is working normal again. Please advise.


Rabbit 3000 PB0 also share this pin to serial clock but still can access UserBlock. I read the default value of SBCR in debug mode that is 0x00 which mean the clocked serial mode is disabled. Not understand PB0 cannot be driven. Checked the document 90001108_H.pdf in the section of 3.3.2: “Note that these pins can be used for Serial Port B in normal operation, so the serial flash may be
accessed with that serial port during normal operation.”

Please advise.

RCM6700 uses a serial flash chip for storage, the Rabbit 3000 products did not. When you go to access the UserBlock on the RCM6700, the library configures PB0 as the SPI clock so it can access the serial flash. I highly recommend using another I/O pin, and reserving PB0 for SPI devices where you use a chip select and _SPIgetSemaphore() to coordinate access to those devices to avoid conflicts.