opening an example project error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

opening an example project error

1,528 Views
turkmani_11
Contributor III

Hi, im trying to open an example project from S32 which is called i2c_transfere as shown bellow

Untitled.png

when its oppened it doesnt give me all of the source files and handle files so i cant use the example project i will be having errors as shown below:

Untitled 2.png

how can i get all of the files so i can work on it? please help me by guiding me with photos or instructions.

Tags (3)
0 Kudos
9 Replies

1,517 Views
PetrS
NXP TechSupport
NXP TechSupport
Hi, try to generate PE code, e.g. through menu Project -> Generate Processor Expert Code Then build again. However seems you are using older S32DS and SDK. Try to use latest one S32DS 2.1 and S32_SDK_S32PA_RTM_3.0.3. BR, Petr
0 Kudos

1,509 Views
turkmani_11
Contributor III

can you please link me the newest version download page or the link to download it directly

0 Kudos

1,500 Views
turkmani_11
Contributor III

ok Mr peter i did download it and started using the example code without doing any modifications to is, im trying to send a simple message of data using the sample code i2c_transfere_mpc5748g.

firslty i connected the pins to 8 and 9 of sda and scl, and attached one of them to a logic analyzer to see if i can get a signal, the other logic analyzer pin is sent to the grnd.

i debug without any errors, but cannot get a message on the logic analyzer , also "istransferok" is false.

you can see the code bellow. its the same as the example given without modifications, can you please guide me to how to be able to send a message and detect it by logic analyzer?

Untitled.png

0 Kudos

1,488 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I did a connection as example description suggests

PetrS_1-1663843613488.png

and this is what I see on I2C lines

PetrS_0-1663843608191.png

isTransferOK is true.

BR, Petr

 

0 Kudos

1,486 Views
turkmani_11
Contributor III

did you change anything in the code?

and where should i write data i  want to send?

/*
* Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "pin_mux.h"
#include "i2c1.h"
#include "dmaController1.h"
#include "clockMan1.h"
#include <devassert.h>
/* User includes (#include below this line is not maintained by Processor Expert) */
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
/* Definition of the data transfer size */
#define TRANSFER_SIZE 16
/* Initialization of slave buffers */
uint8_t slaveTxBuffer[TRANSFER_SIZE] = {0x0, 0x1, 0x02, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
uint8_t slaveRxBuffer[TRANSFER_SIZE] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
i2c_master_state_t i2c1MasterState;
i2c_slave_state_t i2c2SlaveState;
/*!
* @brief I2C Slave Callback
*
* @Param [in] instance I2C instance number
* @Param [in] slaveEvent Event received on the I2C bus
* @Param [in] userData User defined data that is passed to the callback
* @return None
*
* @details This function will be called by I2C interrupt handler and it
* will assign the buffer for TX or RX events.
* If an error event occurs, it will abort the current transfer.
*/
void i2c2_SlaveCallback0(i2c_slave_event_t slaveEvent, void *userData)
{
/* Get instance number from userData */
uint32_t instance;
instance = (uint32_t)userData;
/* Check the event type:
* - set RX or TX buffers depending on the master request type
*/
if (slaveEvent == I2C_SLAVE_EVENT_RX_REQ)
I2C_DRV_SlaveSetRxBuffer((uint8_t)instance, slaveRxBuffer, TRANSFER_SIZE);
if (slaveEvent == I2C_SLAVE_EVENT_TX_REQ)
I2C_DRV_SlaveSetTxBuffer((uint8_t)instance, slaveTxBuffer, TRANSFER_SIZE);
}
volatile int exit_code = 0;
/*!
\brief The main function for the project.
\details The startup initialization sequence is the following:
* - startup asm routine
* - main()
*/
int main(void)
{
/* Declaration of the I2C transfer buffer */
uint8_t masterTxBuffer[TRANSFER_SIZE] ;
/* Variable that is used to initialize the buffers */
uint8_t cnt;
volatile bool isTransferOk = true;
/* Variable used for the loop that initializes the data buffer */
uint16_t i;
/* Use as callback parameter for slave module the I2C instance number */
i2c2_SlaveConfig0.callbackParam = (uint32_t *)INST_I2C2;
/* Initialize and configure clocks
* - Configure system clocks and dividers
* - Configure LPI2C clock gating
* - see clock manager component for details
*/
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_FORCIBLE);
/* Initialize pins
* - Configure I2C pins
* - See PinSettings component for more info
*/
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
/* Initialize I2C Master configuration
* See I2C component for configuration details
*/
I2C_DRV_MasterInit(INST_I2C1, &i2c1_MasterConfig0, &i2c1MasterState);
/* Initialize I2C Master configuration
* See I2C component for configuration details
*/
I2C_DRV_SlaveInit(INST_I2C2, &i2c2_SlaveConfig0, &i2c2SlaveState);
/* Initialize the data buffer */
for (i = 0u; i < TRANSFER_SIZE; i++)
{
masterTxBuffer[i] = i;
}
/* Send a packet of data to the bus slave */
(void) I2C_DRV_MasterSendDataBlocking(INST_I2C1, masterTxBuffer, TRANSFER_SIZE, true, OSIF_WAIT_FOREVER);
/* Check if transfer is completed with no errors */
for (cnt = 0U; cnt < TRANSFER_SIZE; cnt++)
{
/* If the values are not equal, break the loop and set isTransferOk to false */
if((masterTxBuffer[cnt] != slaveRxBuffer[cnt]))
{
isTransferOk = false;
break;
}
}
/* Cast isTransferOk to avoid "set but not used" warnings */
(void)isTransferOk;
/* End of the driver example */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;) {
if(exit_code != 0) {
break;
}
}
return exit_code;
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END main */
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.1 [05.21]
** for the NXP C55 series of microcontrollers.
**
** ###################################################################
*/

this is the code. i still get transfereisok as false

0 Kudos

1,480 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

no, I did not. I just created new project from example (from SDK3.0.3), generated PE code, built and debugged on DEVKIT-MPC5748G (rev D1). Follow example description.

Master transmit buffer is filled in the code

PetrS_0-1663845051095.png

BR, Petr

0 Kudos

1,463 Views
turkmani_11
Contributor III

i added break points, my istransferok is true until after this line  (void) I2C_DRV_MasterSendDataBlocking(INST_I2C1, masterTxBuffer, TRANSFER_SIZE, true, OSIF_WAIT_FOREVER);

i connected pe8 and pe9 as well on my kit , connected sda to analyzer and to ground, i dont seem to get anything, can i see your connections?

0 Kudos

1,440 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

to see the same do below connection

PetrS_0-1663922725932.png

and connect to analyzer. In this example PE9/PE8 is slave's pins and PE11/PE10 master's pins.

BR, Petr

0 Kudos