cancel
Showing results for 
Search instead for 
Did you mean: 

14 bit DCMI with Boson camera

sol barnett
Associate II
Posted on June 03, 2018 at 21:30

Hi I am using the DCMI on STM32H743 in 14 bit mode  with a 16 bit camera but I am only use the 14bits MSB  but I only get 8 bit through the system .

if I change to 12 or 10 the same again only the first 8 bits but a images comes through . but if I select 8 bit mode I get 4 images .

can anyone help ? has anyone used the H743 with 14 bit DCMI ?

thanks 

Sol

6 REPLIES 6
Imen.D
ST Employee
Posted on June 04, 2018 at 11:48

Hello

sol.barnett

,

What do you mean'but I only get 8 bit through the system' ? How do you get 8 bit ?

Which data format used:

RGB, JPEG, YUV...?

It seems to me that you have a configuration problem.

Make sure toconfigure properly your DCMI and camera module,based on the

DCMI application note

http://www.st.com/content/ccc/resource/technical/document/application_note/group0/c0/ef/15/38/d1/d6/49/88/DM00373474/files/DM003734pdf/jcr:content/translations/en.DM003734pdf

which contains DCMI use case examples and DCMI examples based on STM32CubeMX.

With Regards,

Imen.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
sol barnett
Associate II
Posted on June 04, 2018 at 11:56

Hi Imen 

I can send you the set up code could you look at it for me ?

  

Thanks

Sol

sol barnett
Associate II
Posted on June 04, 2018 at 12:19

/* DCMI init function */

static void MX_DCMI_Init(void)

{

hdcmi.Instance = DCMI;

hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;

hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_RISING; //ini

//hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_FALLING; //works the same pic

hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_LOW;//ini

//hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_HIGH; // no pic

hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_LOW;// ini

//hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_HIGH;// no pic

hdcmi.Init.CaptureRate = DCMI_CR_ALL_FRAME; //ini was

//hdcmi.Init.CaptureRate = DCMI_CR_ALTERNATE_2_FRAME;

hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_14B;//CHANGED TO 12 NO DIFFERENCE, 8 bit - got 4 small pics

hdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE;

hdcmi.Init.ByteSelectMode = DCMI_BSM_ALL;

hdcmi.Init.ByteSelectStart = DCMI_OEBS_ODD;

hdcmi.Init.LineSelectMode = DCMI_LSM_ALL;

hdcmi.Init.LineSelectStart = DCMI_OELS_ODD;

if (HAL_DCMI_Init(&hdcmi) != HAL_OK)

{

_Error_Handler(__FILE__, __LINE__);

}

}

/**

* Enable DMA controller clock

*/

static void MX_DMA_Init(void)

{

/* DMA controller clock enable */

__HAL_RCC_DMA1_CLK_ENABLE();

/* DMA interrupt init */

/* DMA1_Stream0_IRQn interrupt configuration */

HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 0x0F, 0); //DCMI

HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn);

}

void BSP_CAMERA_SnapshotStart(uint32_t *buff)

{

/* Start the camera capture */

HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_CONTINUOUS, (uint32_t)buff, CAM_FRAME_BUFFER_SIZE / 2);

}

void DMA1_Stream0_IRQHandler_complete() //DCMI

{

if(bFrameEthUnload2)

{

bFrameEthLoad2 = true;

bFrameEthUnload2 = false;

memcpy((uint16_t *)cam_frame_buffer_2, (uint16_t *)cam_frame_buffer_1, sizeof(cam_frame_buffer_1));

bFrameReady = true;

cnt_frames_written2++;

}

else if(bFrameEthUnload3)

{

bFrameEthLoad3 = true;

bFrameEthUnload3 = false;

memcpy((uint16_t *)cam_frame_buffer_3, (uint16_t *)cam_frame_buffer_1, sizeof(cam_frame_buffer_1));

bFrameReady = true;

cnt_frames_written3++;

}

}

void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi)

{

GPIO_InitTypeDef GPIO_InitStruct;

if(hdcmi->Instance==DCMI)

{

/* USER CODE BEGIN DCMI_MspInit 0 */

/* USER CODE END DCMI_MspInit 0 */

/* Peripheral clock enable */

__HAL_RCC_DCMI_CLK_ENABLE();

/**DCMI GPIO Configuration

PE4 ------> DCMI_D4

PE5 ------> DCMI_D6

PE6 ------> DCMI_D7

PF10 ------> DCMI_D11

PA4 ------> DCMI_HSYNC

PA6 ------> DCMI_PIXCLK

PF11 ------> DCMI_D12

PG7 ------> DCMI_D13

PC8 ------> DCMI_D2

PC9 ------> DCMI_D3

PA9 ------> DCMI_D0

PA10 ------> DCMI_D1

PC10 ------> DCMI_D8

PC12 ------> DCMI_D9

PD3 ------> DCMI_D5

PG9 ------> DCMI_VSYNC

PB5 ------> DCMI_D10

*/

GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;

HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;

HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_9|GPIO_PIN_10;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_9;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;

HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_12;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;

HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_3;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;

HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_5;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;

HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

/* DCMI DMA Init */

/* DCMI Init */

hdma_dcmi.Instance = DMA1_Stream0;

hdma_dcmi.Init.Request = DMA_REQUEST_DCMI;

hdma_dcmi.Init.Direction = DMA_PERIPH_TO_MEMORY;

hdma_dcmi.Init.PeriphInc = DMA_PINC_DISABLE;

hdma_dcmi.Init.MemInc = DMA_MINC_ENABLE;

hdma_dcmi.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;

hdma_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;

hdma_dcmi.Init.Mode = DMA_CIRCULAR; //

hdma_dcmi.Init.Priority = DMA_PRIORITY_HIGH;

hdma_dcmi.Init.FIFOMode = DMA_FIFOMODE_ENABLE;

hdma_dcmi.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;

hdma_dcmi.Init.MemBurst = DMA_MBURST_SINGLE;

hdma_dcmi.Init.PeriphBurst = DMA_PBURST_SINGLE;

if (HAL_DMA_Init(&hdma_dcmi) != HAL_OK)

{

_Error_Handler(__FILE__, __LINE__);

}

__HAL_LINKDMA(hdcmi,DMA_Handle,hdma_dcmi);

/* USER CODE BEGIN DCMI_MspInit 1 */

/* USER CODE END DCMI_MspInit 1 */

}

}

Posted on June 04, 2018 at 13:42

The 14-bit wide allows for cameras of that bit depth to connect with higher bandwidth, but most have byte packing methods or formatting. As Imen indicates the JPEG modes typically use this too, but the byte streams also pack in memory much more efficiently as the image size scales.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on June 04, 2018 at 13:52

not sure if this is the Case with the Boson Camera  by Flir  .  I tested the DCMI interface  by removing one bit at a time .

when I get to bit 8 I no longer get any data come through . I have also checked bit 8 onwards of the camera by putting it in the first 8 bits of the DCMI . so the problem is there is no bits ether collected after bit 7 or the data is going somewhere  else ?

Posted on June 04, 2018 at 16:15

Not a camera I've used, or reviewed the documentation for.

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