November 23, 2024, 12:07:17 AM

Pinguino micro

Started by TuxD3v, May 17, 2013, 03:25:36 PM

Previous topic - Next topic

TuxD3v

Hi guys,

for what i can see in olimex site, in the datasheet.odf

the uext connector is only connected to SPI port of pic32 is that true?

I need some help...

I want to motorize what's going on in a zigbee module that is connected to pinguino micro uext connector.

At the beginning i think that they are talking in uart, bot now i see they are talking in SPI, do you confirm that?

How to catch data, from spi(zigbee module) and send it to the uart connected via usb to the Computer?

thanks in advance

regards
tux


maria_olimex

Hello TuxD3v,

All of our pinguino boards have I2C, UART and SPI pins on the UEXT Connector, you can see specifically which in the board's manual.

Pinguino communicates with MOD-ZIGBEE via UART. You can catch the output with the Serial library and then print it to the computer via the CDC library. Take a look at this example, It's longer, because it uses interrupts to capture data, but everything you need is in there:
https://www.olimex.com/Products/Duino/PIC32/_resources/PINGUINO_MODZIGBEE_example.zip

Notice the capture of data from the Zigbee


void ZIGBEE_get_response(unsigned char uport)
{
char i = 0;
char c;

// Skip the <CR><LF> characters at the beginning of the string
// (if there are any)
c = SerialGetKey(uport);
if(!(c== 0x0d || c== 0x0a)){serial_buffer[i] = c; i++;}

c = SerialGetKey(uport);
if(!(c== 0x0d || c== 0x0a)){serial_buffer[i] = c; i++;}


// The rest of the code is based on the
// SerialGetString function in the
// <serial.c> library
do {
c = SerialGetKey(uport);

    // Stop when you meet the <CR> character
if( c != '\r')
{
serial_buffer[i] = c;
i++;
}

}while( c != '\r' );
serial_buffer[i] = '\0';

//Catch the <LF> character
c = SerialGetKey(uport);

}


...and printing the cstring "m" to the PC:

CDCprintln(m);


Don't forget to use the correct baud rate and port for the communication:

        //Definitions for
// -- PIC32-PINGUINO
// -- PIC32-PINGUINO-OTG
// -- PIC32-PINGUINO-MICRO

#define zport UART2      //The UEXT is on UART2
#define zbaud 19200


Best Regards,
Maria/OLIMEX
Software developer at Olimex