cancel
Showing results for 
Search instead for 
Did you mean: 

stm32cubef4 camera project for stm324xg_eval board

armindavatgaran
Associate III
Posted on April 20, 2015 at 10:50

Hello

According to the page 18 of the ov2640 datasheet(version 1.6), device slave address is 0x60 for write and 0x61 for read, but in the camera_to_usbdisk project, only the write address is defined and used for both read and write operations.

#define CAMERA_I2C_ADDRESS 0x60

Please guide me through this.

Thanks.

3 REPLIES 3
Posted on April 20, 2015 at 14:56

Isn't the low order bit set/cleared deeper into the support code depending if it's a read or write? This is a standard 7-bit I2C addressing mechanism.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
armindavatgaran
Associate III
Posted on April 20, 2015 at 15:08

Do you mean that because of shifting 1 bit to right, the LSB will be excluded ?

Posted on April 20, 2015 at 18:14

Do you mean that because of shifting 1 bit to right, the LSB will be excluded ?

No, I mean that the bit is controlled deeper in the implementation, 0x60 is the base address. I have no interest digging into the HAL/Cube implementation, but on the SPL side this explicitly handled in the library code.

/**
* @brief Transmits the address byte to select the slave device.
* @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
* @param Address: specifies the slave address which will be transmitted
* @param I2C_Direction: specifies whether the I2C device will be a Transmitter
* or a Receiver.
* This parameter can be one of the following values
* @arg I2C_Direction_Transmitter: Transmitter mode
* @arg I2C_Direction_Receiver: Receiver mode
* @retval None.
*/
void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, uint8_t Address, uint8_t I2C_Direction)
{
/* Check the parameters */
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_I2C_DIRECTION(I2C_Direction));
/* Test on the direction to set/reset the read/write bit */
if (I2C_Direction != I2C_Direction_Transmitter)
{
/* Set the address bit0 for read */
Address |= I2C_OAR1_ADD0;
}
else
{
/* Reset the address bit0 for write */
Address &= (uint8_t)~((uint8_t)I2C_OAR1_ADD0);
}
/* Send the address */
I2Cx->DR = Address;
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..