Ping Pong Source Code

  • Hello,


    I've have recently acquired the Ping Pong board, and I'm now giving the first steps with this board and also the MPLAB X. I've have worked a few years ago with MPLAB v7, and this new version of MPLAB have a good few changes... So I'm also relearning to work with MPLAB.


    For start I've downloaded the Ping Pong Source Code zip file and the Ping Pong Manual. I have unzipped the project "PingPong_BSP" to the directory: "C:\Microchip\harmony\v1_05\apps\rtos\freertos". But when I open this project on MPLAB, I get many loading errors.


    And also I've have made a "Clean and Build Project", and have a "Build Failed", like I expected it would happen.


    Need your help, in first place to see if the project directory it's correct, and then to figure out why this problems/errors.


    Send in attachment a few pictures with the errors.


    Thanks.

  • Hello Neves,


    The location where you have placed this project is not correct. Each project has a different location to where you should place it. The BSP project should be placed in :


    C:\Microchip\harmony\v1_05\apps\



    I have just noticed that we didn't mention it for that project in the manual. We will do and upload the new revised verison of it.
    Please relocate it and let me know if all works out.

  • Hello Mazen,


    Maybe for luck, before I have received your reply, I have copied the project to that directory and the loading errors are gone. I only get a few warnings, but I get build successful.


    The warnings are related to the: #define _PLIB_UNSUPPORTED


    If I comment that define, I get different warnings, in the functions related to this define.


    Another question, do you have a pin list of the hardware? A description of how all the hardware is interconnected? If possible the schematic of the board, to better understand the board.
    The 4 LEDs, near the SIM holder are connected the Telit Cellular module and GPS module?


    All the extra information you can provide, I appreciate.


    Thanks.

  • Hi Neves,


    in app.h file, you will find all hardware related connected pin definitions. If you need the schematics, please contact our sales team to sign an NDA and will share the related sections with you. Here are the pin definitions anyway:

    #define ADC_CS PORTS_ID_0,PORT_CHANNEL_D, PORTS_BIT_POS_9
    #define ADC_Select PORTS_ID_0,PORT_CHANNEL_K, PORTS_BIT_POS_5


    #define nInt_Ethernet PORTS_ID_0,PORT_CHANNEL_F, PORTS_BIT_POS_2
    #define nRST_Ethernet PORTS_ID_0,PORT_CHANNEL_F, PORTS_BIT_POS_8
    #define CAN_STDBY PORTS_ID_0,PORT_CHANNEL_K, PORTS_BIT_POS_7


    #define SQI_PWR PORTS_ID_0,PORT_CHANNEL_J, PORTS_BIT_POS_6
    #define SIM_SELECTTION PORTS_ID_0,PORT_CHANNEL_J, PORTS_BIT_POS_7
    #define BLUE_LED PORTS_ID_0,PORT_CHANNEL_E, PORTS_BIT_POS_3
    #define GREEN_LED PORTS_ID_0,PORT_CHANNEL_E, PORTS_BIT_POS_4
    #define ADC_DR PORTS_ID_0,PORT_CHANNEL_K, PORTS_BIT_POS_6
    #define ACC_INT1 PORTS_ID_0,PORT_CHANNEL_A, PORTS_BIT_POS_4
    #define ACC_INT2 PORTS_ID_0,PORT_CHANNEL_H, PORTS_BIT_POS_11


    #define DI1G PORTS_ID_0,PORT_CHANNEL_B, PORTS_BIT_POS_6
    #define DI1P PORTS_ID_0,PORT_CHANNEL_B, PORTS_BIT_POS_7
    #define DI2G PORTS_ID_0,PORT_CHANNEL_A, PORTS_BIT_POS_9
    #define DI2P PORTS_ID_0,PORT_CHANNEL_A, PORTS_BIT_POS_10
    #define DI3G PORTS_ID_0,PORT_CHANNEL_H, PORTS_BIT_POS_15
    #define DI3P PORTS_ID_0,PORT_CHANNEL_K, PORTS_BIT_POS_1
    #define DI4G PORTS_ID_0,PORT_CHANNEL_K, PORTS_BIT_POS_2
    #define DI4P PORTS_ID_0,PORT_CHANNEL_K, PORTS_BIT_POS_3
    #define DO1 PORTS_ID_0,PORT_CHANNEL_H, PORTS_BIT_POS_7
    #define DO2 PORTS_ID_0,PORT_CHANNEL_D, PORTS_BIT_POS_14
    #define DO3 PORTS_ID_0,PORT_CHANNEL_D, PORTS_BIT_POS_15)
    #define DO4 PORTS_ID_0,PORT_CHANNEL_B, PORTS_BIT_POS_12
    #define GPS_PPS PORTS_ID_0,PORT_CHANNEL_D, PORTS_BIT_POS_13
    #define XE910_DCD PORTS_ID_0,PORT_CHANNEL_G, PORTS_BIT_POS_0
    #define XE910__PWRMON PORTS_ID_0,PORT_CHANNEL_J, PORTS_BIT_POS_4
    #define XE910_Switch PORTS_ID_0,PORT_CHANNEL_J, PORTS_BIT_POS_2
    #define XE910_ON_OFF PORTS_ID_0,PORT_CHANNEL_J, PORTS_BIT_POS_3
    #define XE910_OE PORTS_ID_0,PORT_CHANNEL_G, PORTS_BIT_POS_15
    #define XE910_SPI_MRDY PORTS_ID_0,PORT_CHANNEL_B, PORTS_BIT_POS_8
    #define XE910_SPI_SRDY PORTS_ID_0,PORT_CHANNEL_B, PORTS_BIT_POS_11
    #define XE910_SHTDN PORTS_ID_0,PORT_CHANNEL_G, PORTS_BIT_POS_15
    #define Max_1_WIRE PORTS_ID_0,PORT_CHANNEL_H, PORTS_BIT_POS_2



    #define BLUE_LED_ON() PLIB_PORTS_PinClear(BLUE_LED)
    #define BLUE_LED_OFF() PLIB_PORTS_PinSet(BLUE_LED)
    #define GREEN_LED_ON() PLIB_PORTS_PinClear(GREEN_LED)
    #define GREEN_LED_OFF() PLIB_PORTS_PinSet(GREEN_LED)
    #define XE910_PWRMON() PLIB_PORTS_PinGet(XE910__PWRMON)
    #define XE910_IsConnected() !PLIB_PORTS_PinGet(XE910_DCD)

  • Hello Mazen,


    In the app.h file there are two symbols attributed to the same pin:


    #define XE910_OE PORTS_ID_0,PORT_CHANNEL_G, PORTS_BIT_POS_15
    #define XE910_SHTDN PORTS_ID_0,PORT_CHANNEL_G, PORTS_BIT_POS_15


    But only "XE910_OE" it's used... So I think that isn't a problem.


    ------------------------------------------------------------------------------------------------------------------------------------------------------------------


    Another question, in the manual it's said that we can use the function GPS_ParseNMEA() to get GPS data, my question is where we can use this function?
    Inside the APP_Tasks_GPS()?
    Can it be used instead of the function GPS_SendUART2USB()? I've tried this and did not received any information from the module. Thus it have to be receiving valid GPS data to present this information (with the function GPS_ParseNMEA())? The function stays inside the:


    if(DCH0DPTR <10)
    {
    //SendUSBDebugMessage("GPS: NMEA messages are not received");
    return;
    }


    ------------------------------------------------------------------------------------------------------------------------------------


    It's possible to send the schematic of the board?


    Thanks.

  • Hi Neves,


    For the schematics, please contact our sales team and sign the NDA to release the relevant part to you.


    For the function GPS_ParseNMEA(), it can be used instead of GPS_SendUART2USB().
    Below is an implementation of this function in a different application we have:
    Notes: GPSBuffer is an arrany that holds the received GPS data.
    GPSBufferIndex is the size of the data inside the buffer



    void GPS_ParseNMEA()
    {
    uint8_t CommaCount = 0;
    uint8_t GIndex = 0;
    GPSIsValid = false;
    if(GPSBufferIndex <10)
    {
    //not enough data in Buffer to parse
    return;
    }
    for(LoopVar = 0; LoopVar < GPSBufferIndex - 10; LoopVar++)
    {
    if(GPSBuffer[LoopVar]=='R' && GPSBuffer[LoopVar+1]=='M' && GPSBuffer[LoopVar+2]=='C')
    {
    //start counting commas and recording the GPS information we need
    CommaCount = 1;
    break;
    }
    }
    if(CommaCount ==1)
    {
    SpeedIndex = 0;
    HeadingIndex = 0;
    for( ; LoopVar < GPSBufferIndex ;LoopVar++)
    {


    if(GPSBuffer[LoopVar]==',')
    {
    CommaCount++;
    GIndex = 0;
    continue;
    }
    if(CommaCount>10)
    break;
    switch(CommaCount)
    {
    case 2: if(GIndex<6){GTime[GIndex] = GPSBuffer[LoopVar]; GIndex++;} break;
    case 3: if(GPSBuffer[LoopVar]=='A') GPSIsValid = true; break;
    case 4: Latitude[GIndex] = GPSBuffer[LoopVar]; GIndex++; break;
    case 6: Longitude[GIndex] = GPSBuffer[LoopVar]; GIndex++; break;
    case 8: if(GIndex<3){Speed[GIndex] = GPSBuffer[LoopVar]; GIndex++;SpeedIndex++;} break;
    case 9: if(GIndex<3){Heading[GIndex] = GPSBuffer[LoopVar]; GIndex++;HeadingIndex++;} break;
    case 10: if(GIndex<6){GDate[GIndex] = GPSBuffer[LoopVar]; GIndex++;} break;
    }
    }
    if(SpeedIndex==1)
    {
    Speed[2] = Speed[0];
    Speed[1] = '0';
    Speed[0] = '0';
    }
    if(SpeedIndex==2)
    {
    Speed[2] = Speed[1];
    Speed[1] = Speed[0];
    Speed[0] = '0';
    }
    if(HeadingIndex==1)
    {
    Heading[2] = Heading[0];
    Heading[1] = '0';
    Heading[0] = '0';
    }
    if(HeadingIndex==2)
    {
    Heading[2] = Heading[1];
    Heading[1] = Heading[0];
    Heading[0] = '0';
    }
    }
    //Parse GGA Message to get the satellite number
    CommaCount = 0;
    GIndex = 0;
    for(LoopVar = 0; LoopVar < GPSBufferIndex - 10; LoopVar++)
    {
    if(GPSBuffer[LoopVar]=='G' && GPSBuffer[LoopVar+1]=='G' && GPSBuffer[LoopVar+2]=='A')
    {
    //start counting commas and recording the GPS information we need
    CommaCount = 1;
    break;
    }
    }
    if(CommaCount ==1)
    {
    SatIndex=0;
    for( ; LoopVar < GPSBufferIndex ;LoopVar++)
    {
    if(GPSBuffer[LoopVar]==',')
    {
    CommaCount++;
    GIndex = 0;
    continue;
    }
    if(CommaCount>10)
    break;
    if(CommaCount== 8)
    {
    Sat[GIndex] = GPSBuffer[LoopVar];
    GIndex++;
    SatIndex++;
    }
    }
    if(SatIndex==1)
    {
    Sat[1] = Sat[0];
    Sat[0] = '0';
    }
    if(SatIndex>0)
    GPSBufferIndex = 0;
    }


    if(GPSIsValid==true)
    {


    }
    else
    {


    }
    }

  • Hello
    I am new and I just started with ping pong.


    I instaled the latest MPLABX, XC32 and Harmony. When I open project PingPong_BSP there is Project Loading Error:


    Error: Project "PingPong_BSP" refers to file "drv_usb.c" which does not exist in the disk. The project failed to load.
    Error: Project "PingPong_BSP" refers to file "drv_usb_device.c" which does not exist in the disk. The project failed to load.


    Can you help me please?


    Thanks blakra

  • Hello Blakra,


    Where did you place the project folder? It should be in the apps foder inside the Harmory folder.
    Currently the versions we have on our websites work with MPLAB Harmony V1.03 (which you can download and use). We are planning to release new projects next week that work with the latest version of MPLAB Harmony. Microchip has updated their driver Libraries and we need to update our projects accordingly.
    Right now you can use version 1.03 to test the source code. Porting it later to the new project will be easy from your side once we release our new project files.


    P.S: Please open a new thread for further questions.

  • Hey
    thanks for answer. Yea, I read the posts in this thema and because though that it's something small I write here.
    The example was in the right folder, the problem was the Harmony version
    in PP_ADC.c I changed the line 6 to:


    #include "../../v1_03/framework/peripheral/peripheral.h"


    Thanks and best regards!