之前都是使用
STM32F10系列的
单片机做小项目
最近想做视频方面的,给模拟视频转换并显示,看到TVP5150,但大部分是
ARM开发板带的模块。
由于只做视频,再买个ARM太浪费了,看到STM32新品中4系列有DCMI接口,刚好TVP5150能输出YCBCR数据流(可惜如果输出RGB就更好了)。
调试了三周左右,视频一直没有出来,但别人说配置几个寄存器就行了,可我的就是不行。全是黑屏,如果输出
嵌入式同步信号,接收部分选择分离同步信号,屏幕上还有同步的斑点。数据接收没有问题。
昨天我用逻辑分析仪分析输出信号,拿掉了几根数据线,屏幕居然出现了图像!!!
全接上又没有了,接的数据线多少和图像的持续时间有关!!!
这个会不会是高频信号的干扰?(我用杜邦线飞到开发板上的)
还可能是TVP5150的数据输出能力与 STM32数据接口的配置
谁有过这样的经验?我的TVP5150模块在ARM嵌入式开发板淘宝店买的。
void DCMI_DMAInit(void)
{
DCMI_InitTypeDef DCMI_InitStructure;
DMA_InitTypeDef DMA_InitStructure;
/*** Configures the DCMI to interface with the OV9655 camera module ***/
/* Enable DCMI clock */
RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_DCMI, ENABLE);
/* DCMI configura
tion */
DCMI_InitStructure.DCMI_CaptureMode = DCMI_CaptureMode_Continuous;
DCMI_InitStructure.DCMI_SynchroMode = DCMI_SynchroMode_Hardware;
DCMI_InitStructure.DCMI_PCKPolarity = DCMI_PCKPolarity_Falling;
DCMI_InitStructure.DCMI_VSPolarity = DCMI_VSPolarity_High;
DCMI_InitStructure.DCMI_HSPolarity = DCMI_HSPolarity_High;
DCMI_InitStructure.DCMI_CaptureRate = DCMI_CaptureRate_All_Frame;
DCMI_InitStructure.DCMI_ExtendedDataMode = DCMI_ExtendedDataMode_8b;
/* DCMI configuration */
DCMI_Init(&DCMI_InitStructure);
/* Configures the DMA2 to transfer Data from DCMI */
/* Enable DMA2 clock */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);
/* DMA2 Stream1 Configuration */
DMA_DeInit(DMA2_Stream1);
while (DMA_GetCmdStatus(DMA2_Stream1) != DISABLE)
{
}
DMA_InitStructure.DMA_Channel = DMA_Channel_1;
DMA_InitStructure.DMA_PeripheralBaseAddr = DCMI_DR_ADDRESS;
// DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)uData;
DMA_InitStructure.DMA_Memory0BaseAddr = FSMC_LCD_ADDRESS;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
// DMA_InitStructure.DMA_BufferSize = 32000;
DMA_InitStructure.DMA_BufferSize = 1;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
// DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
/* DMA2 IRQ channel Configuration */
DMA_Init(DMA2_Stream1, &DMA_InitStructure);
DMA_ITConfig(DMA2_Stream1, DMA_IT_TC, ENABLE);
/* DMA Stream enable */
DMA_Cmd(DMA2_Stream1, ENABLE);
while ((DMA_GetCmdStatus(DMA2_Stream1) != ENABLE))
{
}
}
static uint8_t TVPReg[][2] =
{
{0x00, 0x00},
{0x02, 0x00},
{0x03, 0x0f},
{0x0d, 0x00},
{0x0f, 0x00},
{0x1b, 0x14},
{0x08, 0x0c},
{0x07, 0x77},
{0x28, 0x00},
// {0x11, 0x32},
// {0x12, 0x00},
// {0x13, 0x32},
// {0x14, 0x02},
// {0x18, 0x55},
// {0x19, 0x80},
};
GPIO的配置模式是这样的
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
GPIO_Init(GPIOC, &GPIO_InitStructure);
一周热门 更多>