CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

[Solved: HW] 24FJ256GA106 - puzzled by output_xxx and pins

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
allenhuffman



Joined: 17 Jun 2019
Posts: 563
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

[Solved: HW] 24FJ256GA106 - puzzled by output_xxx and pins
PostPosted: Fri Feb 12, 2021 9:16 am     Reply with quote

EDIT: It was a hardware issue. Nothing to see here, move along...

I am bringing up a new board based on a 24FJ256GA106. It has two LEDs hooked to I/O pins, and my first test was to create something with the PIC24 wizard that blinks the LEDs fine:

Code:

output_high (PIN_B10); // LED 1 ON
output_low (PIN_B11); // LED 2 OFF
delay_ms (500);

output_low (PIN_B10); // LED 1 OFF
output_high (PIN_B11); // LED 2 ON
delay_ms (500);


But once I started trying to turn the LEDs on manually, I found odd behavior. It wasn't letting me set them both on manually. Even just trying to set them both to high would only turn on one. I've tried output_high() and also output_bit (which is what our existing code uses on the other board).

On the old project, this works fine:

Code:

#define LED_FAULT               PIN_B6          // LED4 enable - Fault
#define LED_RF_ON               PIN_B8          // LED5 enable - RF ON
#define LED_READY               PIN_B11         // LED1 enable - READY
...
void LED_ReadyOn (void)
{
    output_bit (LED_READY, ONE);
}

void LED_ReadyOff (void)
{
    output_bit (LED_READY, ZERO);
}


But the same code on the new board behaves differently. I can't even do this in startup:

Code:

#define LED_COM     PIN_B10
#define LED_FAULT   PIN_B11

output_bit (LED_COM, 1);
output_bit (LED_FAULT, 1);


Before I take this back to the hardware folks, I wanted to post here in case there was something magic I don't know. I am able to control all three LEDs as expected on the older board, but on this new one I cannot.

I spot checked our four other board projects as well, and they do it the same and also work.

Anything obvious I am missing?

UPDATE: One difference in the design is that the I/O pins I am using go through a 74HC05D on the new board. From the data sheet, that shouldn't be affecting other pins, but I need to look more in to this since it's a definite difference.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?


Last edited by allenhuffman on Fri Feb 12, 2021 9:53 am; edited 1 time in total
temtronic



Joined: 01 Jul 2010
Posts: 9244
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Feb 12, 2021 9:44 am     Reply with quote

hmm... random thoughts...

what kind of 'i/o' did you specify ?
standard or fast ?
are the TRIS settings correct ?
any pullups on the PIC/74HC05 ?
is the PIC a 5 volt device ?
allenhuffman



Joined: 17 Jun 2019
Posts: 563
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Feb 12, 2021 9:51 am     Reply with quote

temtronic wrote:
hmm... random thoughts...

what kind of 'i/o' did you specify ?
standard or fast ?
are the TRIS settings correct ?
any pullups on the PIC/74HC05 ?
is the PIC a 5 volt device ?


I'm not sure on any of this yet. I just got the board yesterday and have been going through the schematics to identify all the parts I will be supporting on it. They based the design on our previous 24FJ256GA106, though, but it didn't have this chip between the PIC and the LEDs.

It's looking like a hardware thing. I can blink lights on the other board just fine.

I did try enabling I/O in the PIC24 wizard, which generated this line:

Code:
#use FIXED_IO( B_outputs=PIN_B11,PIN_B10 )


But that had no impact. I've passed this back to the hardware designer to see if there's a short or something in the hardware.

Code:

    while (TRUE)
    {
        DEBUG_PRINTF ("0");
        output_bit (PIN_B10, 0);    // works (both off)
        output_bit (PIN_B11, 0);
        delay_ms (1000);

        DEBUG_PRINTF ("1");
        output_bit (PIN_B10, 0);    // works as expected (B10 off, B11 on)
        output_bit (PIN_B11, 1);
        delay_ms (1000);

        DEBUG_PRINTF ("2");
        output_bit (PIN_B10, 1);    // works as expected (B10 on, B11 off)
        output_bit (PIN_B11, 0);
        delay_ms (1000);

        DEBUG_PRINTF ("3");
        output_bit (PIN_B10, 1);    // bad - both off
        output_bit (PIN_B11, 1);
        delay_ms (1000);
    }

_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
allenhuffman



Joined: 17 Jun 2019
Posts: 563
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Feb 12, 2021 9:52 am     Reply with quote

Whelp, mystery solved. They found a board issue with a pin not being properly grounded. Smile I'm not going mad after all.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Fri Feb 12, 2021 10:35 am     Reply with quote

Well done finding it.
This at heart is 'why' we so often scream to check the hardware!. Especially
as you get to larger chips, being confident that everything really is
connected as you think it is, can get very hard... Sad
allenhuffman



Joined: 17 Jun 2019
Posts: 563
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Feb 12, 2021 11:05 am     Reply with quote

Ttelmah wrote:
Well done finding it.
This at heart is 'why' we so often scream to check the hardware!. Especially
as you get to larger chips, being confident that everything really is
connected as you think it is, can get very hard... Sad


I was really hoping it was a "oh you aren’t doing pin select properly, it should never have worked on your old board" or something ;) I’d rather be dumb and learn something than have to wait for a hardware fix, heh.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
temtronic



Joined: 01 Jul 2010
Posts: 9244
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Feb 13, 2021 6:15 am     Reply with quote

re:
Quote:
Whelp, mystery solved. They found a board issue with a pin not being properly grounded.

Reminds me of a 'mystery module' in one of my remote energy control systems. It worked great Fall, Winter, Summer...then randomly would 'fail to communicate. So swapped it out, set on bench..it worked fine...sigh. Eventually it 'died'. After 2-3 hours located the problem. The 'wiper' of the 5K pot (24Hz clock) hadn't been soldered, so simply a light 'press fit' connection. In the right heat-humidty, the pin went open circuit, clock stopped, board 'died'. Spent the next week design/build a 24Hz clock plugin 'daughter' board with xtal/caps and three 4000 series CMOS chips. After that no problems running modules 15 miles away on copper wires.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group