AnsweredAssumed Answered

AD9375 platform_drivers.h modification with MicroBlaze

Question asked by okabe.y on Jul 30, 2018
Latest reply on Aug 7, 2018 by okabe.y

Hi  Team,

 

We are using 2018_R1 for  AD9375 with MicroBlaze. 

 I would like to confirm  platform_drivers.h with MicroBlaze.

 

There  are 2 GPIOs. One is GPIO1. Other is GPIO2.

AD9528_RESET_B,AD9528_SYSREF and AD9375_RESET_B of GPIO2 are assigned (GPIO2 side) as follows,

 

AD9528_RESET_B : bit 27.
AD9528_SYSREF  :  bit 26
AD9375_RESET_B : bit 20

 

When calling of gpio_set_value(), variable of GPIO is not considered more than 64.
Then, When AD9371_RESET_B(106) is set to ON,
GPIO value is 74 which is result of  Line number 11 of platform_drivers.c. (106-54 = 74)
Line number 17 is execueted  config |= (1 << gpio); // Value of gpio is 74
Howeber value of config is 74%32=10bit. 10bit is enable.
It seems that it is rotated.
So I cannot understand what the  11 line processing is for.
Because 20th bit has it, as for the setting of FPGA, RESET_B of AD9375 does not accord with the calculation either.

 

I have two  questions as follows,

1) I think that a change of platform_drivers.h is necessary to operate it in MicroBlaze.
   Is it correct?
   See comment of "change " in platform_drivers.h which is attached. There are placed 3 location. 

2)May the values of the gpio variable of the argument be more than 64 by the gpio_set_value() function of platform_drivers.c? .


Following are part of platform_drivers.c and platform_drivers.h

[gpio_set_value in platform_drivers.c.  left side number is shoiwn line number ]
 /***************************************************************************//**
 * @brief gpio_set_value
 *******************************************************************************/
1: int32_t gpio_set_value(uint8_t gpio, uint8_t value)
2: {
3: #ifdef _XPARAMETERS_PS_H_
4: XGpioPs_WritePin(&gpio_instance, gpio, value);
5:#else
6: uint32_t config = 0;
7: uint32_t data_reg_addr;
8:
9: if (gpio >= 32) {
10:  data_reg_addr = XGPIO_DATA2_OFFSET;
11:  gpio -= 32;
12: } else
23:  data_reg_addr = XGPIO_DATA_OFFSET;
24:
25: config = Xil_In32((gpio_config->BaseAddress + data_reg_addr));
26: if(value)
27:  config |= (1 << gpio);
28: else
29:  config &= ~(1 << gpio);
30: Xil_Out32((gpio_config->BaseAddress + data_reg_addr), config);
31: #endif
32: return 0;

 

[platform_drivers.h]

/******************************************************************************/
/********************** Macros and Constants Definitions **********************/
/******************************************************************************/
//#define GPIO_OFFSET   54
#define GPIO_OFFSET   0 // change
#define DAC_GPIO_PLDDR_BYPASS GPIO_OFFSET + 60
#define AD9528_RESET_B      GPIO_OFFSET + 59
#define AD9528_SYSREF_REQ   GPIO_OFFSET + 58
#define AD9371_TX1_ENABLE   GPIO_OFFSET + 57
#define AD9371_TX2_ENABLE   GPIO_OFFSET + 56
#define AD9371_RX1_ENABLE   GPIO_OFFSET + 55
#define AD9371_RX2_ENABLE   GPIO_OFFSET + 54
#define AD9371_TEST         GPIO_OFFSET + 53
#define AD9371_RESET_B      GPIO_OFFSET + 52
#define AD9371_GPINT        GPIO_OFFSET + 51
#define AD9371_GPIO_00      GPIO_OFFSET + 50
#define AD9371_GPIO_01      GPIO_OFFSET + 49
#define AD9371_GPIO_02      GPIO_OFFSET + 48
#define AD9371_GPIO_03      GPIO_OFFSET + 47
#define AD9371_GPIO_04      GPIO_OFFSET + 46
#define AD9371_GPIO_05      GPIO_OFFSET + 45
#define AD9371_GPIO_06      GPIO_OFFSET + 44
#define AD9371_GPIO_07      GPIO_OFFSET + 43
#define AD9371_GPIO_15      GPIO_OFFSET + 42
#define AD9371_GPIO_08      GPIO_OFFSET + 41
#define AD9371_GPIO_09      GPIO_OFFSET + 40
#define AD9371_GPIO_10      GPIO_OFFSET + 39
#define AD9371_GPIO_11      GPIO_OFFSET + 38
#define AD9371_GPIO_12      GPIO_OFFSET + 37
#define AD9371_GPIO_14      GPIO_OFFSET + 36
#define AD9371_GPIO_13      GPIO_OFFSET + 35
#define AD9371_GPIO_17      GPIO_OFFSET + 34
#define AD9371_GPIO_16      GPIO_OFFSET + 33
#define AD9371_GPIO_18      GPIO_OFFSET + 32

//#define AD9528_CHIP_SELECT 2
//#define AD9371_CHIP_SELECT 1
#define AD9528_CHIP_SELECT 1 // change
#define AD9371_CHIP_SELECT 2 // change

#ifdef _XPARAMETERS_PS_H_
#define mdelay(msecs)  usleep(1000*msecs)
#else
#define mdelay(msecs)  usleep(50*msecs) // FIXME
#endif
#define udelay(usecs)  usleep(usecs)

#define ARRAY_SIZE(ar)  (sizeof(ar)/sizeof(ar[0]))

 

----------------------------------------------------

Rrgards,

Yoshihiro

Outcomes