cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F427 data transfer in parallel from gpio using 8 ports

dukesong
Associate II
Posted on January 29, 2015 at 08:50

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++;

    }

}

#parallel #stm32f427 #data-transfer
3 REPLIES 3
Posted on January 29, 2015 at 09:30

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

This so out of scale requirement compared to the code you posted, that I am afraid you are struggling with understanding the basic principles of the microcontrollers' working.

You could either try writing the whole word to GPIO at once, and the two writes to toggle the strobe, of course avoiding the ''library'' altogether; or using facilities of FMC (and wiring up the peripherals accordingly). DMA might come handy at some time. But first, read, read, read the manual, and make zillions of experiments.

JW

Posted on January 29, 2015 at 14:07

Oh dear

Your millisecond delay doesn't seem to hit the numbers, but you're not going to go very fast if you wait ~20us (or whatever) per byte and use dozens of machine instructions to output each bit. What's the rate now? 48 KHz?

The GPIO speed setting controls the slew-rate of the pin, ie how fast it moves against a capacitive loading.

A Jan suggests there seems to be a cognitive disconnection between what you want, and what you do.

To hit 36 MHz, consider the FSMC and DMA, or understand/express your interfacing requirements more clearly.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dukesong
Associate II
Posted on January 30, 2015 at 00:45

Thanks all your recommend!

I have two board(same board STM32F427)

1. board for transferring data(8bits data using gpio 8ports)

2. board for receiving data from the other board(transferring board)

so I already consider FSMC or DMA functions but I think is not a case to me..

any suggestion??