cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

Petra
New Contributor II

 

Hello,

I would like to put the XRST pin in high with the following function: CyU3PMipicsiSetSensorControl (CY_U3P_CSI_IO_XRES, CyTrue); but when I call any function that contains Mipi I get the following error: 

c:/program files (x86)/cypress/ez-usb fx3 sdk/1.3/arm gcc/bin/../lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld.exe: BootLedBlink.elf: hidden symbol `CyU3PI2cReceiveBytes' isn't defined
c:/program files (x86)/cypress/ez-usb fx3 sdk/1.3/arm gcc/bin/../lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld.exe: final link failed: Bad value

Does anyone have any idea why? thank you

 

 

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator

Hello,

I attached a screenshot to see how it is.

>> For driving XRST pin of CX3, you need to use CyU3PMipicsiSetSensorControl API from the fw_lib

​We started with a simple example and we tried to modify this one, if you say is not the proper one we can take another.

>>Yes, the bootledblink firmware uses boot_lib which is generally used while using second stage bootloader. You can modify any of the CX3 examples of the SDK (Path:(Path: SDK installation\Cypress\EZ-USB FX3 SDK\1.3\firmware\cx3_examples)

IS there a problem if we don't use while(1) nor RTOS? Is it mandatory ? We only need to read a deserializer register (DS90UB960-Q1) at this moment.

>>The CyU3PMipicsiSetSensorControl uses the RTOS functions internally. As the RTOS is not initialized in the firmware you shared, the errors are seen.

Regards,
Rashi

View solution in original post

0 Likes
6 Replies
Rashi_Vatsa
Moderator
Moderator

Hello,

Please let me know which firmware are you using for your application.

It seems that you are using FX3 boot library and FX3 firmware library. Please let me know the reason of using boot library. We recommend to use the firmware library (fw_lib) for the functions like CyU3PI2cReceiveBytes.

Please refer to the attached snippet for the linker settings.

As you are using CX3 for the application, please refer to this KBA Steps to Setup up MIPI CSI Camera Solution with CX... - Cypress Developer Community for  the steps for generating the firmware using CX3 MIPI Receiver Tool

Regards,
Rashi
0 Likes
Petra
New Contributor II

Hello, 

This is my code and that why I use fx3_boot_library. 

/*
## Cypress FX3 Boot Firmware Example Source file (main.c)
## ===========================
##
## Copyright Cypress Semiconductor Corporation, 2011-2012,
## All Rights Reserved
## UNPUBLISHED, LICENSED SOFTWARE.
##
## CONFIDENTIAL AND PROPRIETARY INFORMATION
## WHICH IS THE PROPERTY OF CYPRESS.
##
## Use of this file is governed
## by the license agreement included in the file
##
## <install>/license/license.txt
##
## where <install> is the Cypress software
## installation root directory path.
##
## ===========================
*/

#include "cyfx3device.h"
#include "cyfx3utils.h"
#include "cyfx3gpio.h"
#include "defines.h"
#include "cyfx3i2c.h"
#include "cyu3mipicsi.h"

/* Code to read and boot FX3 firmware from I2C EEPROM. */

#define I2C_BUS_TIMEOUT_VALUE (0xFFFFFFFFu)
#define I2C_DMA_TIMEOUT_VALUE (0xFFFFu)
#define I2C_FREQUENCY (400000u)

#define I2C_SLAVE_ADDRESS (0xA0u)
//#define I2C_SLAVE_ADDRESS (0x50)
#define I2C_CMD_WRITE (0)
#define I2C_CMD_READ (1)
#define I2C_START_BYTE2 (0x0004)
#define I2C_RETRY_CNT (2)

#define FW_HEADER_SIZE (4)
#define SECTION_HEADER_SIZE (8)

#define I2C_SLAVE_SPACE (0x10000)
#define GET_BYTE0(addr) ((uint8_t)((addr) & 0xFF))
#define GET_BYTE1(addr) ((uint8_t)(((addr) >> 😎 & 0xFF))

static uint8_t gI2cSlaveAddr = 0;
static uint32_t gI2cByteAddr = 0;
static uint32_t gReadBuf[4]= {0xFF, 0xFF, 0xFF, 0xFF};
static uint8_t gWriteBuf[4] = {1, 2, 3, 4};

/****************************************************************************
* main:
****************************************************************************/

CyBool_t I2c_Write (void)
{
CyFx3BootErrorCode_t status;
CyFx3BootI2cConfig_t i2cConfig;
CyFx3BootI2cPreamble_t preamble;
uint8_t *wd_buf = (uint8_t *)gWriteBuf;

status = CyFx3BootI2cInit ();
if (status != CY_FX3_BOOT_SUCCESS)
return CyFalse;


i2cConfig.busTimeout = I2C_BUS_TIMEOUT_VALUE;
i2cConfig.dmaTimeout = I2C_DMA_TIMEOUT_VALUE;
i2cConfig.isDma = CyFalse;
i2cConfig.bitRate = I2C_FREQUENCY;
status = CyFx3BootI2cSetConfig (&i2cConfig);
if (status != CY_FX3_BOOT_SUCCESS)
return CyFalse;

preamble.buffer[0] = I2C_SLAVE_ADDRESS | I2C_CMD_WRITE;
preamble.buffer[1] = 0x10;
preamble.buffer[2] = 0x00;
preamble.length = 3;
preamble.ctrlMask = 0;

status = CyFx3BootI2cTransmitBytes(&preamble, wd_buf, FW_HEADER_SIZE, I2C_RETRY_CNT);
if (status == CY_FX3_BOOT_SUCCESS)
{
return CyTrue;
}

return CyFalse;
}

 

CyBool_t I2c_Read (void)
{
CyFx3BootErrorCode_t status;
CyFx3BootI2cConfig_t i2cConfig;
CyFx3BootI2cPreamble_t preamble;
uint8_t *rd_buf = (uint8_t *)gReadBuf;

status = CyFx3BootI2cInit ();
if (status != CY_FX3_BOOT_SUCCESS)
return CyFalse;


i2cConfig.busTimeout = I2C_BUS_TIMEOUT_VALUE;
i2cConfig.dmaTimeout = I2C_DMA_TIMEOUT_VALUE;
i2cConfig.isDma = CyFalse;
i2cConfig.bitRate = I2C_FREQUENCY;
status = CyFx3BootI2cSetConfig (&i2cConfig);
if (status != CY_FX3_BOOT_SUCCESS)
return CyFalse;

preamble.buffer[0] = I2C_SLAVE_ADDRESS | I2C_CMD_WRITE;
preamble.buffer[1] = 0x10;
preamble.buffer[2] = 0x00;
preamble.buffer[3] = I2C_SLAVE_ADDRESS | I2C_CMD_READ;
preamble.length = 4;
preamble.ctrlMask = I2C_START_BYTE2;

status = CyFx3BootI2cReceiveBytes (&preamble, rd_buf, FW_HEADER_SIZE, I2C_RETRY_CNT);
if (status == CY_FX3_BOOT_SUCCESS)
{
if ((rd_buf[0] == 1) && (rd_buf[1] == 2) && (rd_buf[2] == 3))
{
return CyTrue;
}
}

return CyFalse;
}

 

int main (void)
{
CyFx3BootErrorCode_t status;
CyFx3BootIoMatrixConfig_t ioCfg;
CyFx3BootGpioSimpleConfig_t gpioConf;
CyBool_t value;

/* HW and SW initialization code */
CyFx3BootDeviceInit (CyTrue);


/* Enable the GPIOs for the LED and the switch. */
ioCfg.isDQ32Bit = CyFalse;
ioCfg.useUart = CyFalse;
ioCfg.useI2C = CyFalse;
ioCfg.useI2S = CyFalse;
ioCfg.useSpi = CyFalse;
ioCfg.gpioSimpleEn[0] = 0;
ioCfg.gpioSimpleEn[1] = (1 << (APP_LED_GPIO1 - 32)) | (1 << (APP_SWITCH_GPIO - 32) | (1 << (APP_LED_GPIO2 - 32)) | (1 << (APP_LED_GPIO3 - 32)) | (1 << (APP_LED_GPIO4 - 32)));

status = CyFx3BootDeviceConfigureIOMatrix (&ioCfg);
if (status != CY_FX3_BOOT_SUCCESS)
{
return status;
}

/* Initialize the GPIO module. */
CyFx3BootGpioInit ();

/* Configure the GPIO for reading the switch input. */
gpioConf.inputEn = CyTrue;
gpioConf.driveLowEn = CyFalse;
gpioConf.driveHighEn = CyFalse;
gpioConf.outValue = CyFalse;
gpioConf.intrMode = CY_FX3_BOOT_GPIO_NO_INTR;

status = CyFx3BootGpioSetSimpleConfig (APP_SWITCH_GPIO, &gpioConf);
if (status != CY_FX3_BOOT_SUCCESS)
return status;

/* Configure the GPIO for driving the LED. */
gpioConf.inputEn = CyFalse;
gpioConf.driveLowEn = CyTrue;
gpioConf.driveHighEn = CyTrue;
gpioConf.outValue = CyFalse;
gpioConf.intrMode = CY_FX3_BOOT_GPIO_NO_INTR;

status = CyFx3BootGpioSetSimpleConfig (APP_LED_GPIO1, &gpioConf);
if (status != CY_FX3_BOOT_SUCCESS)
return status;


status = CyFx3BootGpioSetSimpleConfig (APP_LED_GPIO2, &gpioConf);
if (status != CY_FX3_BOOT_SUCCESS)
return status;


status = CyFx3BootGpioSetSimpleConfig (APP_LED_GPIO3, &gpioConf);
if (status != CY_FX3_BOOT_SUCCESS)
return status;


status = CyFx3BootGpioSetSimpleConfig (APP_LED_GPIO4, &gpioConf);
if (status != CY_FX3_BOOT_SUCCESS)
return status;

/* We keep looping around and copying the state of the SWITCH GPIO onto the LED GPIO. */
// I2c_Write();

// value = I2c_Write();
// value= I2c_Read();
value= I2c_Read();

if (value == CyTrue)
{
CyFx3BootGpioSetValue(APP_LED_GPIO1, CyTrue); // 0 1 1 0
CyFx3BootGpioSetValue(APP_LED_GPIO2, CyFalse);
CyFx3BootGpioSetValue(APP_LED_GPIO3, CyFalse);
CyFx3BootGpioSetValue(APP_LED_GPIO4, CyTrue);

} else
{
CyFx3BootGpioSetValue(APP_LED_GPIO1, CyFalse); // 1 0 0 1
CyFx3BootGpioSetValue(APP_LED_GPIO2, CyTrue);
CyFx3BootGpioSetValue(APP_LED_GPIO3, CyTrue);
CyFx3BootGpioSetValue(APP_LED_GPIO4, CyFalse);
}

return 0;
}
/*[]*/

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please let me know more details on your application.

I got the firmware from this thread  CyU3PMipicsiSetSensorControl(CY_U3P_CSI_IO_XRES,Cy... - Cypress Developer Community  

I cannot see CyU3PI2cReceiveBytes in the code snippet that you have shared by the error logs shared by you in the main post shows that error due to CyU3PI2cReceiveBytes.  CyU3PI2cReceiveBytes/CyU3PI2cTransmitBytes API which are part of firmware library are called internally by CyU3PMipicsiSetSensorControl. Please let me know how is XRES of de-serializer connected to CX3 ? Is it connected to GPIO of CX3? If yes, please let me know the GPIO number of CX3 to which you want to connect the XRES of de-serializer

c:/program files (x86)/cypress/ez-usb fx3 sdk/1.3/arm gcc/bin/../lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld.exe: BootLedBlink.elf: hidden symbol `CyU3PI2cReceiveBytes' isn't defined

Please let me know the reason of using bootledblink firmware as base for your application firmware for CX3. 

CyU3PMipicsiSetSensorControl internally looks for mutex lock which is an OS function. The code snippet you shared doesn't use OS. Please try using boot APIs as the application uses boot library. CyU3PMipicsiSetSensorControl is API from firmware library.

Also, I do not understand your application, I noticed that neither the  while(1) nor RTOS is not used for continuous execution of the firmware.

Please refer  and modify  the OV5640 example of the firmware of the FX3 SDK (Path: SDK installation\Cypress\EZ-USB FX3 SDK\1.3\firmware\cx3_examples)

Regards,
Rashi
0 Likes
Petra
New Contributor II

Hello Rashi_Vatsa,

I deleted from the example Cx3RGB16AS0260 and in the file cycx_uvc.c in the main () function I called this 2 functions to set the XRST pin on high: CyU3PMipicsiReset (CY_U3P_CSI_HARD_RST);
CyU3PMipicsiSetSensorControl (CY_U3P_CSI_IO_XRES, CyTrue);

but it is not set to high, what functions need to be called besides these 2, thank you.


int main (void)
{
CyU3PErrorCode_t status;
CyU3PIoMatrixConfig_t ioCfg;
CyU3PGpioSimpleConfig_t gpioConf;
CyBool_t value;

/* HW and SW initialization code */
CyU3PDeviceInit (0);


/* Enable the GPIOs for the LED and the switch. */
ioCfg.isDQ32Bit = CyFalse;
ioCfg.useUart = CyFalse;
ioCfg.useI2C = CyFalse;
ioCfg.useI2S = CyFalse;
ioCfg.useSpi = CyFalse;
ioCfg.gpioSimpleEn[0] = 0;
ioCfg.gpioSimpleEn[1] = (1 << (APP_LED_GPIO1 - 32)) | (1 << (APP_SWITCH_GPIO - 32) | (1 << (APP_LED_GPIO2 - 32)) | (1 << (APP_LED_GPIO3 - 32)) | (1 << (APP_LED_GPIO4 - 32)));

status = CyU3PDeviceConfigureIOMatrix (&ioCfg);
if (status != CY_U3P_SUCCESS)
{
return status;
}

/* Initialize the GPIO module. */
CyU3PGpioDeInit();

CyU3PMipicsiInitializeGPIO ();
/* Configure the GPIO for driving the LED. */
gpioConf.inputEn = CyFalse;
gpioConf.driveLowEn = CyTrue;
gpioConf.driveHighEn = CyTrue;
gpioConf.outValue = CyFalse;
gpioConf.intrMode = CY_U3P_SUCCESS;

status = CyU3PGpioSetSimpleConfig (APP_LED_GPIO1, &gpioConf);
if (status != CY_U3P_SUCCESS)
return status;


status = CyU3PGpioSetSimpleConfig (APP_LED_GPIO2, &gpioConf);
if (status != CY_U3P_SUCCESS)
return status;


status = CyU3PGpioSetSimpleConfig (APP_LED_GPIO3, &gpioConf);
if (status != CY_U3P_SUCCESS)
return status;


status = CyU3PGpioSetSimpleConfig (APP_LED_GPIO4, &gpioConf);
if (status != CY_U3P_SUCCESS)
return status;

/* We keep looping around and copying the state of the SWITCH GPIO onto the LED GPIO. */
// I2c_Write();
CyU3PMipicsiReset(CY_U3P_CSI_HARD_RST);
CyU3PMipicsiSetSensorControl(CY_U3P_CSI_IO_XRES, CyTrue);
// value = I2c_Write();
// value= I2c_Read();
value= I2c_Read();

if (value == CyTrue)
{
CyU3PGpioSetValue(APP_LED_GPIO1, CyTrue); // 0 1 1 0
CyU3PGpioSetValue(APP_LED_GPIO2, CyFalse);
CyU3PGpioSetValue(APP_LED_GPIO3, CyFalse);
CyU3PGpioSetValue(APP_LED_GPIO4, CyTrue);

} else
{
CyU3PGpioSetValue(APP_LED_GPIO1, CyFalse); // 1 0 0 1
CyU3PGpioSetValue(APP_LED_GPIO2, CyTrue);
CyU3PGpioSetValue(APP_LED_GPIO3, CyTrue);
CyU3PGpioSetValue(APP_LED_GPIO4, CyFalse);
}

return 0;
while(1);

}

 

0 Likes
Petra
New Contributor II

Hello,

 

Please let me know how is XRES of de-serializer connected to CX3 ? Is it connected to GPIO of CX3?
I attached a screenshot to see how it is.
Please let me know the reason of using bootledblink firmware as base for your application firmware for CX3.
We started with a simple example and we tried to modify this one, if you say is not the proper one we can take another.
Also, I do not understand your application, I noticed that neither the while(1) nor RTOS is not used for continuous execution of the firmware.
IS there a problem if we don't use while(1) nor RTOS? Is it mandatory ? We only need to read a deserializer register (DS90UB960-Q1) at this moment.
 
Thank you 
0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

I attached a screenshot to see how it is.

>> For driving XRST pin of CX3, you need to use CyU3PMipicsiSetSensorControl API from the fw_lib

​We started with a simple example and we tried to modify this one, if you say is not the proper one we can take another.

>>Yes, the bootledblink firmware uses boot_lib which is generally used while using second stage bootloader. You can modify any of the CX3 examples of the SDK (Path:(Path: SDK installation\Cypress\EZ-USB FX3 SDK\1.3\firmware\cx3_examples)

IS there a problem if we don't use while(1) nor RTOS? Is it mandatory ? We only need to read a deserializer register (DS90UB960-Q1) at this moment.

>>The CyU3PMipicsiSetSensorControl uses the RTOS functions internally. As the RTOS is not initialized in the firmware you shared, the errors are seen.

Regards,
Rashi

View solution in original post

0 Likes