GPIOs in BF706
Hi,
How to configure a port pin to function as a GPIO in BF706. Why there is no "defbf70x_base.h" as there is for other BF processors like "defbf52x_base.h" where the port masks are defined. what about port masks in case of BF70x. Are they not required??? Please any one would through some light on this issue... I just atarted to work on BF706 and CCES1.1.
Also if some good tutorial manual is made available for CCES1.1, that will be highly appreciable.
Thanks & Regards,
Srikanth.
Hello Srikanth.
In CCES, each processor has its own header file rather than a dependency on a base header that is common to all. It is located in the system sub-directory. For the ADSP-BF706 processor, it is:
<CCES Root Directory>\Blackfin\include\sys\defBF706.h
In addition to using the header file along with the HRM and datasheet for working with GPIO, CCES also features a plug-in during project initialization that facilitates processor initialization for GPIO, which is called Pin Multiplexing. When you use the New Project Wizard, one of the steps is to include add-ins...if you select the Pin Multiplexing add-in at this point, you will have access to it from your System Initialization File (system.svc file, a required input file for all CCES projects, which is auto-generated). If you select the Pin Multiplexing tab from the system.svc, you will find a GUI for selecting/configuring pins as peripherals and GPIO. After you've made all your selections via the GUI, when you save the system.svc file, the project will generate the init code required to properly configure the pins and call it at the beginning of your main function before your application code executes. Use CCES Online help for guidance using the Pin Multiplexing add-in.
We also just last week finalized an application note for Getting Started with CCES, and it should be published to the web shortly. In advance of that, I am attaching it here.
-Joe
Assuming this is a good place, I wanted to add here that the pin interrupt example for the EZ-Kit Mini (containing a BF706) does not work because it is missing a call to the pin-interrupt-assignment function. Therefore, code that works looks like this:
/* allocate memory for the GPIO service */
static uint8_t gpioMemory[GPIO_MEMORY_SIZE];
volatile unsigned buttonPressCounter = 0;
/* callback for receiving GPIO input events */
void gpioCallback(ADI_GPIO_PIN_INTERRUPT ePinInt, uint32_t PinIntData, void *pCBParam)
{
if (ePinInt == PUSH_BUTTON_INT && (PinIntData & PUSH_BUTTON_PIN)) {
/* got a push button event */
// G. Fuchs: Using printf in this callback function crashes the app.
//printf("Push Button 1 pressed\n");
buttonPressCounter++;
}
}
void TaskRunFunc(void* arg) {
OS_ERR err;
printf("Welcome to the ADSP-BF706 EZ-Kit Mini Evaluation Platform\n");
// Setup GPIO interrupt handler.
unsigned result;
uint32_t gpioMaxCallbacks;
/* initialize the GPIO service */
result = adi_gpio_Init((void*)gpioMemory, GPIO_MEMORY_SIZE, &gpioMaxCallbacks);
/* set the GPIO direction */
result += adi_gpio_SetDirection(PUSH_BUTTON_PORT, PUSH_BUTTON_PIN, ADI_GPIO_DIRECTION_INPUT);
/* set edge sense mode (PORT G is connected to Pin Interrupt 0) */
result += adi_gpio_SetPinIntEdgeSense(PUSH_BUTTON_INT, PUSH_BUTTON_PIN, ADI_GPIO_SENSE_RISING_EDGE);
/* register pin interrupt callback */
result += adi_gpio_RegisterCallback(PUSH_BUTTON_INT, PUSH_BUTTON_PIN, gpioCallback, (void*)0);
/* assign half port to interrupt channel
G. Fuchs: This call is missing in the EZ-Kit Mini example. */
result += adi_gpio_PinInterruptAssignment(PUSH_BUTTON_INT, ADI_GPIO_PIN_ASSIGN_BYTE_0, PUSH_BUTTON_INT_ASSIGN);
/* enable the pin interrupt mask */
result += adi_gpio_EnablePinInterruptMask(PUSH_BUTTON_INT, PUSH_BUTTON_PIN, true);
printf("Setting up push button handling has finished with%s success.\n",
result == ADI_GPIO_SUCCESS ? "" : "out");
if (result != 0) {
/* uCOS-III tasks should not just drop from their function. If the
* application does not require an infinite loop, then the task should
* destroy itself*/
OSTaskDel(&pushButtonTask, &err);
return;
}
printf("Now, every time you press PB1 on the board the button-press counter value will be displayed.\n");
/* wait for the GPIO input event */
unsigned counter;
while (1) {
counter = buttonPressCounter;
while (counter == buttonPressCounter);
printf("buttonPressCounter = %d\n", buttonPressCounter);
}
}
Please log in to reply.