TODOPIC

Microcontroladores PIC => Pic32 => Mensaje iniciado por: Trust en 19 de Abril de 2010, 10:37:41

Título: PIC32 ETHERNET STARTER KIT
Publicado por: Trust en 19 de Abril de 2010, 10:37:41
Hola,estoy probando la placa PIC32 Ethernet Starter Kit y el problema que tengo es que no puedo hacerla funcionar porque no me la reconoce el Windows 7. La tarjeta enciende los leds cuando le enchufo el usb pero he intentado reinstalar varias veces el Mplab ide 8.46 y no consigo hacerlo funcionar.

En el administrador de dispositivos de W7, me sale que no estan instalados los controladores para este dispositivo.

He buscado informacion pero, no encuentro nada que me diga como solucionar el problema. Me sale un mensaje con un error 1609 y 1332.

Saludos.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: migsantiago en 19 de Abril de 2010, 14:42:22
Hola, esas tarjetas traen manuales de usuario muy completos, ¿has tenido oportunidad de leerlos?
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: LABmouse en 19 de Abril de 2010, 19:04:24
Hola, yo tengo la tarjeta y en XP va bien. No tengo manera de probarte que hacer en seven.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: Trust en 19 de Abril de 2010, 20:33:32
Me he leido el manual que explica la instalacion del driver y ya me funciona. :P

La verdad es que antes de preguntar hay que leer y releer bien, las prisas son malas consejeras.

Tengo que estudiar mucho como funciona este Kit que es muy diferente a lo que yo conocia.
Seria muy interesante que hicieramos un tema con ejemplos de programacion del PIC32.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: migsantiago en 20 de Abril de 2010, 10:57:24
Me he leido el manual que explica la instalacion del driver y ya me funciona. :P

La verdad es que antes de preguntar hay que leer y releer bien, las prisas son malas consejeras.

Tengo que estudiar mucho como funciona este Kit que es muy diferente a lo que yo conocia.
Seria muy interesante que hicieramos un tema con ejemplos de programacion del PIC32.


Qué bueno que ya funciona.

Hay una carpeta de ejemplos en el directorio de instalación de C32. El kit que compraste también debe traer varios. Si tienes dudas de alguno los podemos checar en conjunto.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: gbaldrich en 27 de Octubre de 2011, 10:43:38
Hola, les agradezco que me puedan enviar una imagen del CD de Ethernet Starter Kit.

Ya que compre el dispositivo pero me vino sin CD
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: AKENAFAB en 27 de Octubre de 2011, 15:34:47
Lo mas seguro es que este en la pagina de microchip.

Te dejo el enlace (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2615&dDocName=en545713)
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 16 de Enero de 2012, 16:00:49
Alguno de ustedes ha utilizado el "PIC32 ESK TCPIP Demo"???? o le ha aparecido el error de la imagen q adjunto... estoy utilizando el PIC32 ethernet starter kit, me baje el "PIC32 ESK TCPIP Demo" de la pagina de Michrochip lo compile pero me salio ese error y no tengo ni idea de que seria.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 20 de Enero de 2012, 12:11:44
Hola, el error ya esta solucionado, era el compilador que era muy vieja y no tenia esa funcion, lo actualice y listo, pero el MPLABX todavia como que tiene problema con el PIC32 ETHERNET STARTER KIT por que no le pude poner a hacer el debug, instale el MPlab 8.8 y funciono perfectamente, asi que me tocara seguir en el viejito  :(

Se pueden tener varias conexiones con el stack TCPIP de microchip???
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 27 de Enero de 2012, 13:03:57
Si, ya me entere que si se podía, ademas lo probé y funciono, si alguien necesita la ayuda le expli con mucho gusto aunque todavia tengo una duda  :D :D :D, ahora mi proximo paso es utilizar el USB de este modulo, alguien lo ha intentado???
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: Suky en 27 de Enero de 2012, 23:09:43
Entre los mismos ejemplos de Microchips Solutions hay de USB, device y Host  ;-)
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 28 de Enero de 2012, 09:58:51
si gracias, no los habia visto.. a trabajar  :-/ :-/ :-/ :-/ :-/
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 04 de Febrero de 2012, 13:50:44
:( me pospusieron el usb, ahora necesito conectarme como cliente tcp, busque en el archivo GenericTCPClient.c de microchip, y allí esta un ejemplo, lo pase a mi código, pero no se me conecta, aunque tampoco me dice que el socket sea invalido, miren mi código:


static BYTE       ServerName[] =   "111.111.124.1";
static DWORD    Timer;

// Defines the URL to be requested by this HTTP client
//static ROM BYTE RemoteURL[] = "/search?as_q=Microchip&as_sitesearch=microchip.com";

__TCPNIMOCLIENT TCPNIMOClient;


void initnimotest(void){//Inicializador de la aplicacion nuestra

   TCPNIMOClient.TCPNIMOSocket = TCPOpen((DWORD)&ServerName[0], TCP_OPEN_RAM_HOST, TCP_NIMO_PORT, TCP_PURPOSE_GENERIC_TCP_CLIENT);
         
   if(TCPNIMOClient.TCPNIMOSocket==INVALID_SOCKET){
         LED1_IO = 1;return;
   }

        LED2_IO = 1;
}

Si no funcionara me encendiera el led 1 pero el nunca lo enciendo solo el led 2, osea que el socket esta "bien", pero en mi servidor no veo conexión.... q podría ser????
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: Suky en 04 de Febrero de 2012, 14:39:03
Pero proba pidiendo datos al servidor y mostrarlo en el cliente  ;-) Ahí al solicitar datos podes ver si ocurre algún inconveniente.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 06 de Febrero de 2012, 09:43:41
Ya lo intente, pero al servidor no le llega ninguna pregunta que le mande desde el cliente, así que la conexión no esta establecida, ya creo q me voy a volver loco  :D
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 06 de Febrero de 2012, 12:46:00
Ya me funcionoooooooooooooooooooo... ya se que era, estaba definiendo el puerto mal y no me había dado cuenta, yo lo tenia así:

#define TCP_NIMO_PORT       1572

Y el código de muestra lo tenia así

static WORD TCP_NIMO_PORT = 1572;

Lo cambie y me funciono perfectamente, así que otro problema mas resuelto, ahora mirare si se puede ser cliente y servidor al mismo tiempo.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 24 de Febrero de 2012, 10:23:20
Hola, yo he estado trabajando con el Stack TCPIP de Microchip, he trabajado con el archivo demo de microchip, ahora quiero armar yo mismo el stack por que con ese demo no puedo editar el stack ya que trae un archivo .a que no se puede editar, ahora bien, no he logrado compilar ese stack, siempre me sale un error, de algun lado distinto siempre me sale un error, quisiera saber si alguien  me puede ayudar con esto o me puede pasar el proyecto compilado para poder editarlo y agregarle el programa que yo he hecho, gracias.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: Suky en 24 de Febrero de 2012, 13:18:34
Que error te marca?
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 15 de Marzo de 2012, 17:40:13
Bueno lo que hice fue que busque uno ya armado completamente y desde allí estoy trabajando, hasta ahora no había tenido problemas, pero ahora quise utilizar el servidor y cliente al mismo tiempo pero no me funciona, en el proyecto de ejemplo donde solamente esta el archivo .a (que creo que es una librería), si me funciona ya ya la verde me he leído eso pero no encuentro que sera lo que me hace falta, quisiera saber si a alguno le ha pasado eso y me puede ayudar, gracias.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 29 de Marzo de 2012, 15:20:06
Hola, quisiera saber si el stack tcp/ip de microchip funciona sin cristal???
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: MGLSOFT en 29 de Marzo de 2012, 15:35:47
Si a lo que te refieres es a utilizar el reloj interno a la velocidad necesaria para que corra el stack, deberia poderse hacer sin problema.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 30 de Marzo de 2012, 09:34:34
hasta ahora he estado probando con el reloj interno una rutina que me entregue datos por el uart, pero solo he podido llegar hasta 4800, no he podido llegar a 9600 con reloj interno y sin pll, si se puede llegar hasta los 9600??? si quieren puedo publicar mi codigo
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: MGLSOFT en 30 de Marzo de 2012, 09:48:12
En realidad si no activas el PLL y te vas bien arriba con los Mhz del micro, es casi imposible que logres buena sincronización en los envíos.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 30 de Marzo de 2012, 09:50:52
estoy probando con el pll y se me hace mas lenta la comunicacion  :shock:
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: MGLSOFT en 30 de Marzo de 2012, 10:11:43
Si activaste el PLL, debes seleccionar un baudrate 4 veces mayor, o sea la configuración de la Uart debe ser cambiada a la de un cristal de frecuencia 4 veces mayor, se entiende??
Ejemplo: Si tu frecuencia interna elegida es de 4 Mhz y activas el PLL, el micro funcionara a 16Mhz reales, por lo tanto los cálculos de seteos de la Uart debes hacerlos por 16 Mhz
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 30 de Marzo de 2012, 10:21:37
hola, mira, buscando en internet me di cuenta que me hacían falta dos fuses de configuración, los probé como vi el ejemplo y me funciono, aquí esta la pagina de donde lo tome y mi código:

Curso PIC32 Osciladores (http://www.aquihayapuntes.com/curso-pic32/osciladores-timer.html)

Código: [Seleccionar]
/*********************************************************************
 *
 *                  UART Interrupt Example
 *
 *********************************************************************
 * FileName:        uart_interrupt.c
 * Dependencies:
 * Processor:       PIC32
 *
 * Complier:        MPLAB C32
 *                  MPLAB IDE
 * Company:         Microchip Technology Inc.
 *
 * Software License Agreement
 *
 * The software supplied herewith by Microchip Technology Incorporated
 * (the “Company”) for its PIC32 Microcontroller is intended
 * and supplied to you, the Company’s customer, for use solely and
 * exclusively on Microchip PIC32 Microcontroller products.
 * The software is owned by the Company and/or its supplier, and is
 * protected under applicable copyright laws. All rights are reserved.
 * Any use in violation of the foregoing restrictions may subject the
 * user to criminal sanctions under applicable laws, as well as to
 * civil liability for the breach of the terms and conditions of this
 * license.
 *
 * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
 * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
 * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
 * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 *
 *
 * $Id: uart_interrupt.c 9390 2008-06-16 23:43:04Z rajbhartin $
 * $Name: x.x $
 *
 **********************************************************************/

/***********************************************************************************
UART Interrupt Example README
 ***********************************************************************************
 * Objective: Become familiar with PIC32MX tool suite and understand
 *   basic UART Interrupt operations.
 *
 * Tools:
 * 1. MPLAB with PIC32MX support
 * 2. C32 Compiler
 * 3. Explorer 16 Rev 4 or 5 board.
 * 4. RS-232 Cable
 * 5. A Terminal program for Windows - HyperTerminal
 *
 *
 ***********************************************************************************
 ***********************************************************************************/

#include <plib.h> // Peripheral Library

// *****************************************************************************
// *****************************************************************************
// Section: Configuration bits
// SYSCLK = 80 MHz (8MHz Crystal/ FPLLIDIV * FPLLMUL / FPLLODIV)
// PBCLK = 40 MHz
// Primary Osc w/PLL (XT+,HS+,EC+PLL)
// WDT OFF
// Other options are don't care
// *****************************************************************************
// *****************************************************************************
/*#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_1

#pragma config FWDTEN = OFF, POSCMOD = OFF, FNOSC = FRCPLL, CP = OFF, FPLLODIV = DIV_256
#pragma config FMIIEN = OFF, FETHIO = OFF, FPLLIDIV = DIV_12, FPLLMUL = MUL_15*/

#pragma config FNOSC = FRCPLL//Oscilador Interno con PPL
#pragma config POSCMOD = OFF //
#pragma config FPBDIV = DIV_1//divisor Bus Periféricos
#pragma config FWDTEN = OFF//Wachdog deshabilitado
#pragma config FPLLODIV = DIV_1//Pos-Divisor PPL 1/1
#pragma config FPLLIDIV = DIV_2//Pre-Divisor PPL 1/2
#pragma config FPLLMUL = MUL_20// 20xPPL

//SYSTEMConfigPerformance(80000000ul);

// *****************************************************************************
// *****************************************************************************
// Section: System Macros
// *****************************************************************************
// *****************************************************************************
/*
#define GetSystemClock() (2000000ul)
#define GetPeripheralClock() (GetSystemClock()/(1 << OSCCONbits.PBDIV))
#define GetInstructionClock() (GetSystemClock())
*/
#define GetSystemClock() (80000000ul) // Hz
#define GetInstructionClock() (GetSystemClock()/1) // Normally GetSystemClock()/4 for PIC18, GetSystemClock()/2 for PIC24/dsPIC, and GetSystemClock()/1 for PIC32.  Might need changing if using Doze modes.
#define GetPeripheralClock() (GetSystemClock()/1) // Normally GetSystemClock()/4 for PIC18, GetSystemClock()/2 for PIC24/dsPIC, and GetSystemClock()/1 for PIC32.  Divisor may be different if using a PIC32 since it's configurable.

#define DESIRED_BAUDRATE    (9600)      //The desired BaudRate

#define LED_ON_OFF_TRIS (TRISAbits.TRISA0)
#define LED_ON_OFF (LATAbits.LATA0)

#define LED_Rx_U1_TRIS (TRISAbits.TRISA1)
#define LED_Rx_U1 (LATAbits.LATA1)
#define LED_Rx_U3_TRIS (TRISAbits.TRISA4)
#define LED_Rx_U3 (LATAbits.LATA4)
#define LED_Tx_U3_TRIS (TRISAbits.TRISA3)
#define LED_Tx_U3 (LATAbits.LATA3)
#define LED_Tx_U1_TRIS (TRISAbits.TRISA2)
#define LED_Tx_U1 (LATAbits.LATA2)

void WriteString(const char *string);

int main(void)
{
OSCTUNbits.TUN=0;
OSCCONbits.COSC = 7;
DDPCONbits.JTAGEN=0;

LED_ON_OFF_TRIS =   0;
LED_Rx_U3_TRIS = 0;
LED_Tx_U3_TRIS = 0;
LED_Rx_U1_TRIS = 0;
LED_Tx_U1_TRIS = 0;

LED_Tx_U1 = 0;
LED_Rx_U1 = 0;
LED_Tx_U3 = 0;
LED_Rx_U3 = 0;

//U1MODEbits.BRGH=1;
//U1BRG=108;

// Configure the device for maximum performance but do not change the PBDIV
// Given the options, this function will change the flash wait states, RAM
// wait state and enable prefetch cache but will not change the PBDIV.
// The PBDIV value is already set via the pragma FPBDIV option above..
SYSTEMConfig(GetSystemClock(), SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE);

mPORTAClearBits(BIT_7); // Turn off RA7 on startup.
mPORTASetPinsDigitalOut(BIT_7); // Make RA7 as output.


// Explorer-16 uses UART1 to connect to the PC.
// This initialization assumes 36MHz Fpb clock. If it changes,
// you will have to modify baud rate initializer.
    UARTConfigure(UART1, UART_ENABLE_PINS_TX_RX_ONLY);
    UARTSetFifoMode(UART1, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY);
    UARTSetLineControl(UART1, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1);
    UARTSetDataRate(UART1, GetPeripheralClock(), DESIRED_BAUDRATE);
    UARTEnable(UART1, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));

// Configure UART1 RX Interrupt
INTEnable(INT_SOURCE_UART_RX(UART1), INT_ENABLED);
    INTSetVectorPriority(INT_VECTOR_UART(UART1), INT_PRIORITY_LEVEL_2);
    INTSetVectorSubPriority(INT_VECTOR_UART(UART1), INT_SUB_PRIORITY_LEVEL_0);

    // configure for multi-vectored mode
    INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR);

    // enable interrupts
    INTEnableInterrupts();




// UARTSendDataByte(UART1, 0x3f);

   WriteString("*** UART Interrupt-driven Application Example ***\r\n");
   WriteString("*** Type some characters and observe echo and RA7 LED toggle ***\r\n");

while(1)
{
LED_Tx_U1 = 1;
DelayMs(100);
LED_Tx_U1 = 0;
DelayMs(100);
}


// Let interrupt handler do the work
while (1){LED_ON_OFF = 1;}

return 0;
}

void Delay10us(DWORD dwCount)
{
volatile DWORD _dcnt;

_dcnt = dwCount*((DWORD)(0.00001/(1.0/GetInstructionClock())/10));
while(_dcnt--)
{
Nop();
Nop();
Nop();
}
}

void DelayMs(WORD ms)
{
    unsigned char i;
    while(ms--)
    {
        i=4;
        while(i--)
        {
            Delay10us(25);
        }
    }
}

// helper functions
void WriteString(const char *string)
{
    while(*string != '\0')
    {
        while(!UARTTransmitterIsReady(UART1))
            ;

        UARTSendDataByte(UART1, *string);

        string++;

        while(!UARTTransmissionHasCompleted(UART1))
            ;
    }
}
//void PutCharacter(const char character)
void PutCharacter(char character)
{
        while(!UARTTransmitterIsReady(UART1))
            ;

//if(character==0x09){LED_Rx_U1 = 1;}

        UARTSendDataByte(UART1, character);


        while(!UARTTransmissionHasCompleted(UART1))
            ;
}
// UART 1 interrupt handler
// it is set at priority level 2
void __ISR(_UART1_VECTOR, ipl2) IntUart1Handler(void)
{LED_Rx_U1 = 1;
// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART1)))
{
// Clear the RX interrupt Flag
    INTClearFlag(INT_SOURCE_UART_RX(UART1));

// Echo what we just received.
PutCharacter(UARTGetDataByte(UART1));


// Toggle LED to indicate UART activity
mPORTAToggleBits(BIT_7);

}

// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART1)) )
{
INTClearFlag(INT_SOURCE_UART_TX(UART1));
}
}

De verdad muchas gracias por la ayuda, voy a seguir probando, ahora que termine de probar el uart, voy a probar el ethernet con el cristal interno y creo que necesitare algunos ajustes, cuando se termine y funcione ese codigo tambien se subira  :-/ :-/ :-/
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: MGLSOFT en 30 de Marzo de 2012, 10:55:07
Interesante, no sabia que estabas con el PIC32...
Cuanto mas info puedas aportar mejor, es una materia pendiente que tengo... :mrgreen: :mrgreen:
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 30 de Marzo de 2012, 11:14:59
claro MGLSOFT, de casualidad mira lo que me pasa ahora, yo tengo una board que tiene el ethernet, dos usb pero funcionan como cdc por medio de un driver, dos puertos rs232, 6 entradas análogas, 5 salidas digitales y 5 entradas digitales, fue un primer experimento y tiene sus errores  :D. esta utilizando un PIC32MX795F512L, lo primero que estaba haciendo era probar los uart, pero no me funcionaron ya que los fuses estaban para utilizar cristal y cristal no tengo, ahora que ya se configuro estoy ordenando el código que monte ahorita y cuando termine que fui a compilar me sale error en la interrupción del uart 3, yo lo configure exactamente igual a como estaba configurado el uart 1 pero me dice esto:

Código: [Seleccionar]
source\uart_interrupt.c:271:1: error: Vector number must be an integer between 0 and 63
entonces es hora de resolver un nuevo problema  :o  :D ... tambien me ha sorprendido que el pic32 tiene uart a y b y no tengo ni idea de como se configuran los b, los uart que tengo yo implementado con los uart 1 y 3 a,a ver si tienes idea de esto.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: Suky en 30 de Marzo de 2012, 12:18:51
Si colocas _UARTx_VECTOR (reemplazar x), no funciona? Ayuda utilizar el Help de C32  ;-)
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 30 de Marzo de 2012, 12:21:54
Nada Suky, me sale error, mira

Código: [Seleccionar]
// UART 1 interrupt handler
// it is set at priority level 2
void __ISR(_UART1_VECTOR, ipl2) IntUart1Handler(void)
{
LED_Rx_U1 = 1;

// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART1)))
{
// Clear the RX interrupt Flag
    INTClearFlag(INT_SOURCE_UART_RX(UART1));

// Echo what we just received.
PutCharacter(UARTGetDataByte(UART1));
}

// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART1)) )
{
INTClearFlag(INT_SOURCE_UART_TX(UART1));
}
}

// UART 3 interrupt handler
// it is set at priority level 2
void __ISR(_UART3_VECTOR, ipl2) IntUart3Handler(void)
{
LED_Rx_U3 = 1;

// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART3)))
{
// Clear the RX interrupt Flag
    INTClearFlag(INT_SOURCE_UART_RX(UART3));

// Echo what we just received.
PutCharacter(UARTGetDataByte(UART3));
}

// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART3)) )
{
INTClearFlag(INT_SOURCE_UART_TX(UART3));
}
}

en el uart1 pasa bien, pero en el uart3 me sale este error:

Código: [Seleccionar]
source\uart_interrupt.c:246:1: error: Vector number must be an integer between 0 and 63
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: Suky en 30 de Marzo de 2012, 12:25:32
Puede ser que la versión de C32 tenga alguna modificación. Busca el *.h que define el tema de los vectores para controlar eso. Respecto a habilitar los demás módulos UART, busca en el foro, Nocturno trato el tema.


Saludos!
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 02 de Abril de 2012, 10:34:29
Bueno les comento que ya me funciono, es algo muy raro, pero funciona, en una web de electrónica que no me acuerdo cual es, vi que la persona enumeraba los uart del pic pero invertía el uart 2A y 3A, hoy lo primero que hizo fue invertirlos en mi codigo, y ver si de casualidad me funcionaba, y funciono  :D :D :D

Yo en mi código le cambie el nombre del uart3 al uart2 y probé y me funciono... la verdad no tengo ni idea, aquí voy a dejar mi código funcionando y algunas imágenes.


Código: [Seleccionar]
/*********************************************************************
 *
 *                  UART Interrupt Example
 *
 *********************************************************************
 * FileName:        uart_interrupt.c
 * Dependencies:
 * Processor:       PIC32
 *
 * Complier:        MPLAB C32
 *                  MPLAB IDE
 * Company:         Microchip Technology Inc.
 *
 * Software License Agreement
 *
 * The software supplied herewith by Microchip Technology Incorporated
 * (the “Company”) for its PIC32 Microcontroller is intended
 * and supplied to you, the Company’s customer, for use solely and
 * exclusively on Microchip PIC32 Microcontroller products.
 * The software is owned by the Company and/or its supplier, and is
 * protected under applicable copyright laws. All rights are reserved.
 * Any use in violation of the foregoing restrictions may subject the
 * user to criminal sanctions under applicable laws, as well as to
 * civil liability for the breach of the terms and conditions of this
 * license.
 *
 * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
 * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
 * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
 * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 *
 *
 * $Id: uart_interrupt.c 9390 2008-06-16 23:43:04Z rajbhartin $
 * $Name: x.x $
 *
 **********************************************************************/

/***********************************************************************************
UART Interrupt Example README
 ***********************************************************************************
 * Objective: Become familiar with PIC32MX tool suite and understand
 *   basic UART Interrupt operations.
 *
 * Tools:
 * 1. MPLAB with PIC32MX support
 * 2. C32 Compiler
 * 3. Explorer 16 Rev 4 or 5 board.
 * 4. RS-232 Cable
 * 5. A Terminal program for Windows - HyperTerminal
 *
 *
 ***********************************************************************************
 ***********************************************************************************/

#include <plib.h> // Peripheral Library

#pragma config FNOSC = FRCPLL//Oscilador Interno con PPL
#pragma config POSCMOD = OFF //Oscilador externo apagado
#pragma config FPBDIV = DIV_1//divisor Bus Periféricos
#pragma config FWDTEN = OFF//Wachdog deshabilitado
#pragma config FPLLODIV = DIV_1//Pos-Divisor PPL 1/1
#pragma config FPLLIDIV = DIV_2//Pre-Divisor PPL 1/2
#pragma config FPLLMUL = MUL_20// 20xPPL

#define GetSystemClock() (80000000ul) // Hz
#define GetInstructionClock() (GetSystemClock()/1) // Normally GetSystemClock()/4 for PIC18, GetSystemClock()/2 for PIC24/dsPIC, and GetSystemClock()/1 for PIC32.  Might need changing if using Doze modes.
#define GetPeripheralClock() (GetSystemClock()/1) // Normally GetSystemClock()/4 for PIC18, GetSystemClock()/2 for PIC24/dsPIC, and GetSystemClock()/1 for PIC32.  Divisor may be different if using a PIC32 since it's configurable.

#define DESIRED_BAUDRATE    (9600)      //The desired BaudRate

#define LED_ON_OFF_TRIS (TRISAbits.TRISA0)
#define LED_ON_OFF (LATAbits.LATA0)

#define LED_Rx_U1_TRIS (TRISAbits.TRISA1)
#define LED_Rx_U1 (LATAbits.LATA1)
#define LED_Rx_U2_TRIS (TRISAbits.TRISA4)
#define LED_Rx_U2 (LATAbits.LATA4)
#define LED_Tx_U2_TRIS (TRISAbits.TRISA3)
#define LED_Tx_U2 (LATAbits.LATA3)
#define LED_Tx_U1_TRIS (TRISAbits.TRISA2)
#define LED_Tx_U1 (LATAbits.LATA2)

void WriteString_U1(const char *string);
void WriteString_U2(const char *string);

int main(void)
{
DelayMs(200);

DDPCONbits.JTAGEN=0;

configuracion_puertos();
configuracion_uart1();
configuracion_uart2();

// Configure the device for maximum performance but do not change the PBDIV
// Given the options, this function will change the flash wait states, RAM
// wait state and enable prefetch cache but will not change the PBDIV.
// The PBDIV value is already set via the pragma FPBDIV option above..
SYSTEMConfig(GetSystemClock(), SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE);

    // configure for multi-vectored mode
    INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR);

    // enable interrupts
    INTEnableInterrupts();

   WriteString_U1("*** UART 1 Status: OK ***\r\n");
   WriteString_U2("*** UART 2 Status: OK  ***\r\n");

while (1){
LED_ON_OFF = 1;
}
}

void WriteString_U1(const char *string)
{
    while(*string != '\0')
    {
        while(!UARTTransmitterIsReady(UART1));

        UARTSendDataByte(UART1, *string);

        string++;

        while(!UARTTransmissionHasCompleted(UART1));
    }
}

void WriteString_U2(const char *string)
{
    while(*string != '\0')
    {
        while(!UARTTransmitterIsReady(UART2));

        UARTSendDataByte(UART2, *string);

        string++;

        while(!UARTTransmissionHasCompleted(UART2));
    }
}

void PutCharacter_U1(const char character)
{
LED_Tx_U1 = 1;

    while(!UARTTransmitterIsReady(UART1));


    UARTSendDataByte(UART1, character);


    while(!UARTTransmissionHasCompleted(UART1));

LED_Tx_U1 = 0;
}

void PutCharacter_U2(const char character)
{
LED_Tx_U2 = 1;

    while(!UARTTransmitterIsReady(UART2));


    UARTSendDataByte(UART2, character);


    while(!UARTTransmissionHasCompleted(UART2));

LED_Tx_U2 = 0;
}

void configuracion_puertos()
{
LED_ON_OFF_TRIS =   0;
LED_Rx_U2_TRIS = 0;
LED_Tx_U2_TRIS = 0;
LED_Rx_U1_TRIS = 0;
LED_Tx_U1_TRIS = 0;

LED_Tx_U1 = 0;
LED_Rx_U1 = 0;
LED_Tx_U2 = 0;
LED_Rx_U2 = 0;
}

void configuracion_uart1()
{
    UARTConfigure(UART1, UART_ENABLE_PINS_TX_RX_ONLY);
    UARTSetFifoMode(UART1, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY);
    UARTSetLineControl(UART1, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1);
    UARTSetDataRate(UART1, GetPeripheralClock(), DESIRED_BAUDRATE);
    UARTEnable(UART1, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));

// Configure UART1 RX Interrupt
INTEnable(INT_SOURCE_UART_RX(UART1), INT_ENABLED);
    INTSetVectorPriority(INT_VECTOR_UART(UART1), INT_PRIORITY_LEVEL_2);
    INTSetVectorSubPriority(INT_VECTOR_UART(UART1), INT_SUB_PRIORITY_LEVEL_0);
}

void configuracion_uart2()
{
    UARTConfigure(UART2, UART_ENABLE_PINS_TX_RX_ONLY);
    UARTSetFifoMode(UART2, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY);
    UARTSetLineControl(UART2, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1);
    UARTSetDataRate(UART2, GetPeripheralClock(), DESIRED_BAUDRATE);
    UARTEnable(UART2, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));

// Configure UART2 RX Interrupt
INTEnable(INT_SOURCE_UART_RX(UART2), INT_ENABLED);
    INTSetVectorPriority(INT_VECTOR_UART(UART2), INT_PRIORITY_LEVEL_2);
    INTSetVectorSubPriority(INT_VECTOR_UART(UART2), INT_SUB_PRIORITY_LEVEL_0);
}

void Delay10us(DWORD dwCount)
{
volatile DWORD _dcnt;

_dcnt = dwCount*((DWORD)(0.00001/(1.0/GetInstructionClock())/10));
while(_dcnt--)
{
Nop();
Nop();
Nop();
}
}

void DelayMs(WORD ms)
{
    unsigned char i;
    while(ms--)
    {
        i=4;
        while(i--)
        {
            Delay10us(25);
        }
    }
}

// UART 1 interrupt handler
// it is set at priority level 2
void __ISR(_UART1_VECTOR, ipl2) IntUart1Handler(void)
{
LED_Rx_U1 = 1;

// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART1)))
{
// Clear the RX interrupt Flag
    INTClearFlag(INT_SOURCE_UART_RX(UART1));

// Echo what we just received.
PutCharacter_U1(UARTGetDataByte(UART1));

}

// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART1)) )
{
INTClearFlag(INT_SOURCE_UART_TX(UART1));
}

LED_Rx_U1 = 0;
}

// UART 2 interrupt handler
// it is set at priority level 2
void __ISR(_UART2_VECTOR, ipl2) IntUart2Handler(void)
{
LED_Rx_U2 = 1;

// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(UART2)))
{
// Clear the RX interrupt Flag
    INTClearFlag(INT_SOURCE_UART_RX(UART2));

// Echo what we just received.
PutCharacter_U2(UARTGetDataByte(UART2));
}

// We don't care about TX interrupt
if ( INTGetFlag(INT_SOURCE_UART_TX(UART2)) )
{
INTClearFlag(INT_SOURCE_UART_TX(UART2));
}

LED_Rx_U2 = 1;
}


//while(1){LED_Tx_U1 = 1;DelayMs(100);LED_Tx_U1 = 0;DelayMs(100);}

Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 02 de Abril de 2012, 12:27:16
Mi proxima prueba fue quitarle el cristal al Ethernet Starter kit y cambiarle los fusibles para que funcionara el stack TCPIP de Microchip con el reloj interno y... Funciono!!!!!!!!!!

Comprobado, el stack TCPIP de Microchip con el reloj interno funciona.

Lo malo es que en mi board no funciona, creo q algo se daño, voy a revisar y les comento.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: MGLSOFT en 02 de Abril de 2012, 13:16:06
Un pequeño paso para el hombre, pero uno grande para el foro !!!   ((:-)) ((:-)) ((:-)) ((:-)) ((:-))
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 02 de Abril de 2012, 13:17:56
Si, bastante grande, gracias al foro.
Título: Re: PIC32 ETHERNET STARTER KIT
Publicado por: IngRandall en 05 de Mayo de 2012, 13:47:14
hola, estoy intentando juntar los archivos del stack ethernet en una sola carpeta,  logro hacer que me compile, pero no se conecta, y la verdad no tengo ni idea de por que no me conecta, su puestamente estan los archivos necesarios, cambie la ubicacion en los archivos pero no conecta  :5] :5] :5]