Vivado/XSDK 2015.4
Windows 8.1 pro
Lチカ
http://qiita.com/7of9/items/ae916624c13a59ba2992
と関連して、すぐに思いついたのはGPIOのサンプル実行。Lチカしてみる。
system.mssのps7_gpio_0のImport ExamplesからGPIOのサンプルコードを取込んだ。hello_bsp_xgpiops_polled_example_1というプロジェクトが作られた。
src以下にあるxgpiops_polled_example.cのヘッダー部分を見ていると、以下の記載がある。
* Updated the examples for a ZC702 board .
...
#define OUTPUT_PIN 10 /* Pin connected to LED/Output */
ZC702とZYBOはGPIOが異なる。
http://qiita.com/7of9/items/9f35a6b14f4898690237
のリンク先にあるPS側のLEDのピン番号はMIO7だから、以下のようにしてみた。
#if 1 // zybo
#define OUTPUT_PIN 7 /* Pin connected to LED/Output */
#else
#define OUTPUT_PIN 10 /* Pin connected to LED/Output */
#endif
アプリを実行してみるとMIO7に対応するLD4が点灯した。
変更後の問題
しかしながら、上記の変更をすると変更前は
GPIO Polled Mode Example Test
Data read from GPIO Input is 0x1
Successfully ran GPIO Polled Mode Example Test
だったのが以下になってしまった。
GPIO Polled Mode Example Test
GPIO Polled Mode Example Test Failed
1つ目のXGpioPs_ReadPin()の値が0になってしまう。
Data = XGpioPs_ReadPin(&Gpio, OUTPUT_PIN);
if (Data != 1 ) {
return XST_FAILURE;
}
XGpioPs_SetDirectionPin()にてLEDのGPIOをOUTPUT方向にしているのに、それに対してReadPin()をしている点。また、ZYBO用のGPIO変更前はそれでReadPin()の値が1になっていた点、が未消化。
/*
* Set the direction for the pin to be output and
* Enable the Output enable for the LED Pin.
*/
XGpioPs_SetDirectionPin(&Gpio, OUTPUT_PIN, 1);
関連 http://dev.widemeadows.de/2014/03/06/zybo-board-driving-the-ld4-led-using-the-btn4-button/