AnsweredAssumed Answered

STM32F427 data transfer in parallel from gpio using 8 ports

Question asked by song.duke on Jan 29, 2015
Latest reply on Jan 30, 2015 by song.duke
Hi

I have some problems about transferring data.

I want to send data in parallel from gpio 36MHz speed.

I already set GPIO speed 100MHz.

How do I set speed 36Mhz for transferring data in parallel?

here is my code

for(i = 0; i < BUFFER_SIZE; i++)
        {
            char bit_array[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
            HexToBinary(nid_buffer[i], bit_array);


            GPIO_WriteBit(GPIOE, GPIO_Pin_8, bit_array[0]);         //TUN_D0
            GPIO_WriteBit(GPIOE, GPIO_Pin_10, bit_array[1]);        //TUN_D1
            GPIO_WriteBit(GPIOE, GPIO_Pin_9, bit_array[2]);         //TUN_D2
            GPIO_WriteBit(GPIOE, GPIO_Pin_12, bit_array[3]);        //TUN_D3
            GPIO_WriteBit(GPIOE, GPIO_Pin_11, bit_array[4]);        //TUN_D4
            GPIO_WriteBit(GPIOE, GPIO_Pin_14, bit_array[5]);        //TUN_D5
            GPIO_WriteBit(GPIOE, GPIO_Pin_13, bit_array[6]);        //TUN_D6
            GPIO_WriteBit(GPIOE, GPIO_Pin_7, bit_array[7]);         //TUN_D7
            //printf("buffer[%3d] = %d %d %d %d %d %d %d %d\r\n", i, bit_array[0], bit_array[1], bit_array[2],bit_array[3],bit_array[4],bit_array[5],bit_array[6],bit_array[7]);
            GPIO_SetBits(GPIOE, GPIO_Pin_15);                       //TUN_CLK
            delay_ms(1);


            GPIO_ResetBits(GPIOE, GPIO_Pin_15);                     //TUN_CLK
            delay_ms(1);
        }

void Timer2_Configuration(void)
{
    NVIC_InitTypeDef NVIC_InitStructure;
    TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;


    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);


    NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    NVIC_Init(&NVIC_InitStructure);


    TIM_TimeBaseStructure.TIM_Period = 10 - 1;     // 84MHz down to
    TIM_TimeBaseStructure.TIM_Prescaler = 84 - 1;   // 84MHz
    TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
    TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
    TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);


    TIM_Cmd(TIM2, ENABLE);
    TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);
}

void delay_ms(unsigned int del)
{
    Timer2_Counter = 0;
    while(Timer2_Counter < del);
}


void TIM2_IRQHandler(void)
{
    if(TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)
    {
        TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
        Timer2_Counter++;
    }
}


Outcomes