P0.29 vs P1.29

basically miscellaneous, if it doesn't fit another sub-forum enter it here, we might even promote it to its own sub-forum
danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: P0.29 vs P1.29

Post by danlee58 » Tue Jan 27, 2015 7:28 pm

If I set P0.29 High:
HIGH (29);

Then follow with:

I2COUT (29, 26, 0xE0, 9, DRV1);

Pin 29 appears Low when I check it with a VOM. It probably goes High, and then drops Low immediately.

If I comment out 'I2COUT (29, 26, 0xE0, 9, DRV1);', then Pin 29 is HIGH when I check with the VOM.

It appears that the I2COUT procedure affects P0.29, as well as P1.29.

I am going to change the I2COUT call to another pin. The I2C will not work, but maybe Pin 29 will.

I2COUT (22, 26, 0xE0, 9, DRV1);



danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: P0.29 vs P1.29

Post by danlee58 » Tue Jan 27, 2015 7:35 pm

When I changed the I2COUT call to:

I2COUT (22, 26, 0xE0, 9, DRV1);

P0.29 goes High as it should.

There is some interaction between P1.29 & P0.29 in Bitbang.c.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: P0.29 vs P1.29

Post by danlee58 » Tue Jan 27, 2015 7:57 pm

It could be this code in Bitbang.c:

i = INx(sda_pin);

basicchip
Posts: 985
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: P0.29 vs P1.29

Post by basicchip » Wed Jan 28, 2015 9:07 pm

I doubt that INx(sda_pin) with your definition of sda_pin of 22, affects either P0.29 or P1.29.

INx is defined in coridium_pcb.c

Code: Select all

  #define INx(pin)		(pin<32?(LPC_GPIO0->PIN&(1<<pin)?-1:0):pin<64?(LPC_GPIO1->PIN&(1<<(pin-32))?-1:0):pin<96?(LPC_GPIO2->PIN&(1<<(pin-64))?-1:0):pin<128?(LPC_GPIO3->PIN&(1<<(pin-96))?-1:0):(LPC_GPIO4->PIN&(1<<(pin-128))?-1:0))
There is a flag in MakeItC that saves the output of the C pre-processor, that you can use to look at what code is compiled. I have also used the ASM listing to look what the compiler really does.

When you suspect a problem, often a short bit of code can determine whether what you suspect is a problem or that the issue is elsewhere.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: P0.29 vs P1.29

Post by danlee58 » Thu Jan 29, 2015 1:21 am

danlee58 wrote:When I changed the I2COUT call to:

I2COUT (22, 26, 0xE0, 9, DRV1);

P0.29 goes High as it should.

There is some interaction between P1.29 & P0.29 in Bitbang.c.
The original statement is: I2COUT (29, 26, 0xE0, 9, DRV1); I can't set P0.29 High when this statement is in the program.

I changed that statement to: I2COUT (22, 26, 0xE0, 9, DRV1); I can set P0.29 high with this statement in the program.

i = INx(sda_pin); is equivalent to i = INx(29); It should be INx(61);

I'll check the ASM file or the pre-processor to see what the pin number really is.

basicchip
Posts: 985
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: P0.29 vs P1.29

Post by basicchip » Thu Jan 29, 2015 1:31 am

INx(29) is not equivalent to INx(61)

One reads GPIO0 and the other reads GPIO1, bit 29

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: P0.29 vs P1.29

Post by danlee58 » Thu Jan 29, 2015 2:46 am

basicchip wrote:INx(29) is not equivalent to INx(61)

One reads GPIO0 and the other reads GPIO1, bit 29

That is the problem. I want GPIO1, bit 29, and its giving me GPIO0, bit 29. GPIO0, bit 29 is defined as an output, along with GPIO, bit 30.

I pass Pin 29 in I2COUT. That should be P1.29, not P0.29. P0.29 has another function, not related to I2C.

basicchip
Posts: 985
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: P0.29 vs P1.29

Post by basicchip » Thu Jan 29, 2015 3:35 am

Then use 29+32 for P1.29 or 61

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: P0.29 vs P1.29

Post by danlee58 » Sun Feb 01, 2015 11:39 am

I changed INx to IN1, and LOWx to LOW1. I only use I2C for this one interface, and I had already changed SET_SDA_HIGH & SET_SCL_HIGH to INPUT1(sda_pin) & INPUT1(scl_pin).

#define SET_SCL_HIGH INPUT1(scl_pin)
#define SET_SDA_HIGH INPUT1(sda_pin)

#define SET_SCL_LOW {OUTPUT1(scl_pin);LOW1(scl_pin);}
#define SET_SDA_LOW {OUTPUT1(sda_pin);LOW1(sda_pin);}

Post Reply