BusInOut problem

13 Jun 2012

Hello,

I have a problem with BusInOut. My codes are as below.

I have two buses ( 5 bit. cRowBus and cColBus). I made them opendrain output. p29 didn't work, when I tried the first code. (I measure 111101 on cColBus pins, when I write to bus as cColBus.write(63); (111111). p29 was always zero.) I tryed this two codes on two mbed. Both of them were same. After, I tried the second code. (I just canceled cRowBus). It works fine. Can you try these codes on own mbed 1768? What could be the reason for this?

Thanks,

Selim.

1. code: 

#include "mbed.h"

BusInOut cRowBus(p5, p8, p10, p6, p9, p7);      
BusInOut cColBus(p25, p26, p27, p28, p29, p30); 
unsigned char x;
main(){
    cColBus.mode(OpenDrain);
    cColBus.output();
    cRowBus.mode(OpenDrain);
    cRowBus.output();
    while(1) {
        cColBus.write(63);
        wait_ms(500);
        cColBus.write(0);
        wait_ms(500);
    }
}


2. code :

#include "mbed.h"

//BusInOut cRowBus(p5, p8, p10, p6, p9, p7);      
BusInOut cColBus(p25, p26, p27, p28, p29, p30); 
unsigned char x;
main(){
    cColBus.mode(OpenDrain);
    cColBus.output();
  //  cRowBus.mode(OpenDrain);
  // cRowBus.output();
    while(1) {
        cColBus.write(63);
        wait_ms(500);
        cColBus.write(0);
        wait_ms(500);
    }
}
13 Jun 2012

Hi Selim,

Just as a quick test to work out if this is hardware or software, can you try simply toggling p29 as a DigitalOut. This is pretty well tried and tested.

Also, without any details of your hardware setup it is hard to know what you're hoping for. An open drain output will of course always read zero unless there is an external pullup resistor of some description. Without this, it will be floating (most likely at zero), or driven to zero.

Hope this helps.

Cheers, Chris

13 Jun 2012

Dear Chris,

Thanks for your reply.

The buses have pullup resistors. All pins works well as open drain BusInOut except p29 when I define two BusInOut bus. P29 works well open drain BusInOut when I define only one bus. I also tried, you said condition. I did p29 as a DigitalOut and it worked. I have two mbed. Both of them works same. Can you also try my codes on a mbed.

Thanks,

Selim.

Chris Styles wrote:

Hi Selim,

Just as a quick test to work out if this is hardware or software, can you try simply toggling p29 as a DigitalOut. This is pretty well tried and tested.

Also, without any details of your hardware setup it is hard to know what you're hoping for. An open drain output will of course always read zero unless there is an external pullup resistor of some description. Without this, it will be floating (most likely at zero), or driven to zero.

Hope this helps.

Cheers, Chris