Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 months 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 ; spiPort.write(val); byte = byte << 1 ; spiPort.write(val | (1 << 5)); } spiPort.write(0);
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).
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