Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PIC32MX695F512H RB12 help
Author | Message | ||||
trippyben Regular Member Joined: 26/06/2011 Location: AustraliaPosts: 91 |
I am struggling to get RB12 to work on my DuinoMite Standard board. Its got a PIC32MX695F512H on board. According to the circuits RB12 is connected to the shield header's D9 and LED2. No probs there, the multimeter confirms it. I am programming in C, using MPLAB X and the C32 compiler. I have disabled all of the traps (or so I thought) that get in the way such as JTAG, but I cannot get RB12 to iniatilise and operate as a digital output. Here's the relevant bits of code for setting things up: #define OUT1_2 IOPORT_D,BIT_1 #define OUT3_4 IOPORT_D,BIT_2 #define IN1_2 IOPORT_D,BIT_9 #define IN3_4 IOPORT_D,BIT_10 #define TEST_OUT IOPORT_E,BIT_0 #define ARM IOPORT_E,BIT_1 #define HANDBRAKE IOPORT_E,BIT_2 #define CLUTCH IOPORT_E,BIT_3 #define LIGHT_RED IOPORT_E,BIT_4 #define LIGHT_GREEN IOPORT_E,BIT_5 #define SWITCH_OVER IOPORT_E,BIT_7 #define ARMLED IOPORT_B,BIT_12 //Bit name defined here for RB12 #define LIMITLED IOPORT_B,BIT_15 void main(void) { SYSTEMConfig( FCY, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE); INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR); DDPCON = 0; //disable JTAG PMCON = 0; //Disable PMP AD1PCFG = 0xFFFF; //set all I/O to digital AD1CON1 = 0; //Ensure A/D off CM1CON = 0; CM2CON = 0; //make sure comparators off PORTSetPinsDigitalOut(OUT1_2); PORTSetPinsDigitalOut(OUT3_4); PORTSetPinsDigitalOut(SWITCH_OVER); PORTSetPinsDigitalOut(TEST_OUT); PORTSetPinsDigitalOut(ARMLED); //this line should set the RB12 output PORTSetPinsDigitalOut(LIMITLED); PORTSetPinsDigitalOut(LIGHT_RED); PORTSetPinsDigitalOut(LIGHT_GREEN); PORTSetPinsDigitalIn(IN1_2); PORTSetPinsDigitalIn(IN3_4); PORTSetPinsDigitalIn(ARM); PORTSetPinsDigitalIn(HANDBRAKE); PORTSetPinsDigitalIn(CLUTCH); PORTClearBits(LIGHT_RED); PORTClearBits(LIGHT_GREEN); PORTClearBits(ARMLED); //and this line should make it go low PORTClearBits(LIMITLED); PORTClearBits(OUT1_2); PORTClearBits(OUT3_4); PORTClearBits(SWITCH_OVER); PORTClearBits(TEST_OUT); while(1); //But even if I freeze the program here, RB12 does not want to play! I have tried setting bits directly using instructions like TRISBbits.RB13 as well as the library functions currently in the code. Neither seems to work. I hoping someone who has already battled this output might be able to shed some light on what I have missed. Thanks Ben. |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3196 |
I have not found anything special that is required to make B12 work. I presume that your definitions of IOPORT_B and BIT_12 are correct. Also, on the Duimomite the signal goes through a jumper pad which should be soldered over. My technique would be to switch to B11 and see if that worked - perhaps that would offer a clue. Geoff Geoff Graham - http://geoffg.net |
||||
trippyben Regular Member Joined: 26/06/2011 Location: AustraliaPosts: 91 |
Those definitions come from ports.h #define BIT_12 (1 << 12) typedef enum { #ifdef _PORTA IOPORT_A, #endif #ifdef _PORTB IOPORT_B, #endif #ifdef _PORTC IOPORT_C, #endif #ifdef _PORTD IOPORT_D, #endif #ifdef _PORTE IOPORT_E, #endif #ifdef _PORTF IOPORT_F, #endif #ifdef _PORTG IOPORT_G, #endif IOPORT_NUM }IoPortId; They seem to be sensible. B11 does indeed work. I'm starting to wonder if I have a dud chip. Will have to buy a couple more! These are the headers I have included. Maybe I'm missing a useful one? #include <p32xxxx.h>
#include <plib.h> #include <xc.h> #include <stdio.h> #include <string.h> #include <float.h> #include <math.h> |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2914 |
Gday Ben, I think RB12 is also VGA_Vsync... have you disabled Video in your firmware? If not that might be your problem. Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
trippyben Regular Member Joined: 26/06/2011 Location: AustraliaPosts: 91 |
Hey Mick, no maximite stuff left, I've replaced the MMfirmware - I'm programming the PIC directly in C. |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2914 |
OK Sorry, I cant help then as C is alien to me... Good Luck Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
aargee Senior Member Joined: 21/08/2008 Location: AustraliaPosts: 255 |
Hi Ben, Could it be that B12 is broken? Either a dry solder joint or B12 has had some electrical stress in the past and is not functional? Just a thought. - Rob. For crying out loud, all I wanted to do was flash this blasted LED. |
||||
JTR0701 Regular Member Joined: 10/07/2013 Location: AustraliaPosts: 71 |
Hi Ben, Try turning JTAG off in the config words as well. -Jim |
||||
trippyben Regular Member Joined: 26/06/2011 Location: AustraliaPosts: 91 |
Thanks Mick. Rob - the electrical connections on the board are OK - I'm starting to think the chip itself is broken. Jim - I don't see any JTAG bits in the config words? DDPCON seems to be the only access point on this device. The debugger bits in config should already be set to disabled as below. #pragma config POSCMOD=XT, FNOSC=PRIPLL, DEBUG=OFF #pragma config FPLLIDIV=DIV_2, FPLLMUL=MUL_20, FPLLODIV=DIV_1 #pragma config FPBDIV=DIV_2, FWDTEN=OFF, CP=OFF, BWP=OFF, ICESEL=ICS_PGx1 |
||||
JTR0701 Regular Member Joined: 10/07/2013 Location: AustraliaPosts: 71 |
Ok, may have got my devices confused. Sorry about that. |
||||
trippyben Regular Member Joined: 26/06/2011 Location: AustraliaPosts: 91 |
Thanks for the ideas. It's always worth a check. |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2914 |
Gday Trippyben, Don has his duinomites down to half price, I think, at the moment so it might be worth buying another one to test if your chip is dead. Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
trippyben Regular Member Joined: 26/06/2011 Location: AustraliaPosts: 91 |
lol, I have taken advantage of Don's stock sell-out already. Those e-mega boards I bought at half price were a steal - should have got more! No more standards left by the looks - only mini's. I've ordered some PIC32's now from microchip direct. I have 2 other duinomite standards that I killed while testing with my eyes shut. |
||||
akashh Senior Member Joined: 19/01/2014 Location: IndiaPosts: 115 |
The UBW32 board I ordered had some pins not properly soldered. So it does happen. Take a multimeter in continuity mode and check for connectivity between the pin in question and the digital out. If it doesn't work, heat up your soldering iron, make sure there is no solder on it, apply heat paste to the ship and lightly run it over, this will usually fix it. |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3805 |
Can you put back MMBasic and does RB12 then work? That would decide if it's software or hardware. John |
||||
trippyben Regular Member Joined: 26/06/2011 Location: AustraliaPosts: 91 |
A broken PIC is was. |
||||
Print this page |