Report
5 years, 10 months ago.

DigitalInOut Pull Ups don't appear to be working

I am trying to interface with an MMC card via the MMC protocol (SPI not available) which requires communication via clocked CMD and data lines. On startup communication is only via CMD (two way) and is initially in opendrain mode. I am trying to communicate using DigitalInOut with the internal pull ups but they don't appear to be working.

test code

DigitalInOut _cmd(P2_12);
main()
{
    _cmd.mode(PullUp);
    _cmd.mode(OpenDrain);
    ...
    while(1)
    {
        _cmd.output();
        _cmd = 1;
        wait_ms(1);
        _cmd = 0;
        wait_ms(1);
        _cmd = 1;
        wait_ms(1);
        _cmd = 0;
        wait_ms(1);
        _cmd.input();
//        _cmd.mode(PullUp);
//        _cmd.mode(OpenDrain);
        uint8_t x = _cmd;
        wait_ms(10);
    }

I am expecting the signal to look like Output 1ms high, 1ms low, 1ms high, 1ms low, Input: 10ms high (via pull ups) however within the 10ms input section it is remaining low: /media/uploads/hyperdrive/pullups.bmp

From the code I have tried setting the pull up and open drain within the loop in case it wasn't held between input/output switching.

Comment on this question
Be the first to answer this question.

To post an answer, please log in.