6 years, 1 month ago.

Does PortOut work on k22F platform ?

I'am trying to get PortOut to work i one of my programm but don't see any activity on the port. The code i'am using is the following :

init of port

#define SPI_MASK ((1 << 5) | (1 << 7)) 
PortOut spiPort(PortC, SPI_MASK);

and then

writing to port

 for(i = 0 ; i < 8 ; i ++){
        val = byte & 0x80 ;
        byte = byte << 1 ;
        spiPort.write(val | (1 << 5));

I'am trying to bit bang spi on these pins and to get better performance that the best i could achieve using DigitalOut (500kHz clock).

Question relating to:

The FRDM-K22F is an ultra-low-cost development platform for Kinetis K Series K2x (K22F) MCUs built on ARM® Cortex™-M4 processor. Features include easy access to MCU I/O, battery-ready, low-power operation, a …

I don't think PortOut has ever been verified to work, so it is possible it does not function properly. However in general if you want to bitbang just two lines, I would advice you to use FastIO, that will be faster.

posted by Erik - 12 Apr 2015
Be the first to answer this question.