11-29-2016 08:22 AM
Using ZC702. Running Linux on local processor and FreeRTOS on remote processor. Using openAMP. Successfully ran echo test.
Added DS23 LED blinking code to FreeRTOS task using XGpioPs and pin 10:
#include "xgpiops.h"
#define GPIO_DEVICE_ID XPAR_XGPIOPS_0_DEVICE_ID
#define OUTPUT_PIN 10
void prvSetGpioHardware(int Value);
void prvLed_Toggle (int Value);
XGpioPs Gpio;
XGpioPs_Config *ConfigPtr;
int gpioState;
void prvSetGpioHardware(int Value)
{
/*
* Initialize the GPIO driver.
*/
ConfigPtr = XGpioPs_LookupConfig(GPIO_DEVICE_ID);
XGpioPs_CfgInitialize(&Gpio, ConfigPtr, ConfigPtr->BaseAddr);
/*
* Set the direction for the pin to be output and
* Enable the Output enable for the LED Pin.
*/
XGpioPs_SetDirectionPin(&Gpio, OUTPUT_PIN, 1);
XGpioPs_SetOutputEnablePin(&Gpio, OUTPUT_PIN, 1);
/*
* Set the GPIO output to be gpioState.
*/
XGpioPs_WritePin(&Gpio, OUTPUT_PIN, Value);
}
void prvLed_Toggle (int Value)
{
int Data;
/*
* Set the GPIO Output to Value.
*/
XGpioPs_WritePin(&Gpio, OUTPUT_PIN, Value);
/*
* Read the state of the data and verify. If the data
* read back is not the same as the data written then
* return FAILURE.
*/
Data = XGpioPs_ReadPin(&Gpio, OUTPUT_PIN);
if (Data != Value ) {
xil_printf("shaheds:Pin Data=%d != Value=%d \r\n", Data, Value);
}
}
Added code to "processing" loop that gets called repeatedly to echo test message from Linux side via openAMP messaging:
gpioState = gpioState ^ 0x01;
prvLed_Toggle(gpioState);
Added code to main():
gpioState = 0;
prvSetGpioHardware(gpioState);
Added following code to system-top.dts:
&amba {
gpio-leds {
compatible="gpio-leds";
led-user8 {
label="led-user8";
gpios=<&gpio0 8 0>;
default-state = "off";
};
led-user10 {
label="led-user10";
gpios=<&gpio0 10 0>;
default-state = "off";
};
led-user11 {
label="led-user11";
gpios=<&gpio0 11 0>;
default-state = "off";
};
led-user15 {
label="led-user15";
gpios=<&gpio0 15 0>;
default-state = "off";
};
};
};
I DO SEE DS23 LED TOGGLING USING PIN=10 in FreeRTOS code.
I CANNOT ACCESS ANY OTHER PINS -- such as PMOD2_0,1,2,3.
I also cannot toggle any other LEDs.
What is the solution? Thanks.
11-29-2016 08:50 PM