Hello all, I am working with sabre lite board and using camkes framework. In my implementation I have a driver component that has 7 dataport buf and I connected these buffers to hardware component. In source of component driver I am initialize gpio_sys, mux_sys and pins using these functions: - imx6_mux_init() - imx6_gpio_sys_init() - gpio_new() Here I have copied some part of my code: ****************************************** gpio_sys_t gpio_sys; gpio_t pins[32*7]; mux_sys_t mux_sys; void gpio__init() { imx6_mux_init(NULL, &mux_sys); imx6_gpio_sys_init((void*)gpio0, (void*)gpio1, (void*)gpio2, (void*)gpio3, (void*)gpio4, (void*)gpio5, (void*)gpio6, &mux_sys, &gpio_sys); } void gpio_init_pin(int pin, int direction) { if(pin>0 && pin< sizeof(pins)/sizeof(pins[0])) { gpio_new(&gpio_sys, pin, (enum gpio_dir)direction, &pins[pin]); } } void gpio_set_pin(int pin, int value) { if(pin >= 0 && pin < (sizeof(pins)/sizeof(pins[0]))) { if(value) { gpio_set(&pins[pin]); } else { gpio_clr(&pins[pin]); } } } int gpio_read_pin(int pin) { if(pin>0 && pin< sizeof(pins)/sizeof(pins[0])) { return gpio_get(&pins[pin]); } return -1; } ****************************************** By calling "gpio_init_pin(ALARM_PIN= 28, 0);" I am getting this error: Assertion failed: bank->data == v (PATH/projects/util_libs/libplatsupport/src/plat/imx6/gpio.c: imx6_gpio_write: 144) How can I fix this error? How should I specify the GPIO pins? Thank you for your time and consideration, Parvaneh.
Hi Parvaneh,
By calling "gpio_init_pin(ALARM_PIN= 28, 0);" I am getting this error: Assertion failed: bank->data == v (PATH/projects/util_libs/libplatsupport/src/plat/imx6/gpio.c: imx6_gpio_write: 144) How can I fix this error? How should I specify the GPIO pins?
The assertion is located inside the function which writes out to GPIO pins and it checks if it correctly writes out a value. From what you have provided, I'm guessing that you have problems writing to ALARM_PIN or pin 28. However, it seems that you are initialising the GPIO pin to be an input pin and not an output pin. The 'gpio_init_pin' call should take '1' as the second argument which corresponds to 'GPIO_DIR_OUT_DEFAULT_LOW/GPIO_DIR_OUT' in the 'gpio_dir' enum in the gpio.h header in libplatsupport [1]. Sincerely, Damon [1] https://github.com/seL4/util_libs/blob/master/libplatsupport/arch_include/ar... P.S. I think your checkout of the 'util_libs' repository is old. The 'gpio_write' functions have been replaced by the 'gpio_set' and 'gpio_clear' functions. The pin chaining functionality also got moved into a different header file here: https://github.com/seL4/util_libs/blob/master/libplatsupport/arch_include/ar...
Hello all, I find your response to my question in Dvel Archive http://sel4.systems/pipermail/devel/2020-January/002652.html. I changed the parameter of gpio_new() that I am calling in my gpio_init_pin() (I changed it from 0 to 1 to have output direction). But I keep getting same error: imx6_gpio_init@gpio.c:96 Invalid GPIO Assertion failed: bank->data == v (libplatsupport/src/plat/imx6/gpio.c: imx6_gpio_set_level: 136) My question is that could it be because of pin number that I pass to gpio_new function. Here I have copied parts of my code: ****************************************** gpio_sys_t gpio_sys; gpio_t pins[32*7]; mux_sys_t mux_sys; void gpio__init() { imx6_mux_init(NULL, &mux_sys); imx6_gpio_sys_init((void*)gpio0, (void*)gpio1, (void*)gpio2, (void*)gpio3, (void*)gpio4, (void*)gpio5, (void*)gpio6, &mux_sys, &gpio_sys); } void gpio_init_pin(int pin, int direction) { if(pin>0 && pin< sizeof(pins)/sizeof(pins[0])) { gpio_new(&gpio_sys, pin, (enum gpio_dir)direction, &pins[pin]); } } void gpio_set_pin(int pin, int value) { if(pin >= 0 && pin < (sizeof(pins)/sizeof(pins[0]))) { if(value) { gpio_set(&pins[pin]); } else { gpio_clr(&pins[pin]); } } } int gpio_read_pin(int pin) { if(pin>0 && pin< sizeof(pins)/sizeof(pins[0])) { return gpio_get(&pins[pin]); } return -1; } ****************************************** Can any one help me to solve this problem? Thank you, Parvaneh. On Tue, Jan 28, 2020 at 12:40 PM Parvaneh Ahgajani < aghajani.parvaneh@gmail.com> wrote:
Hello all,
I am working with sabre lite board and using camkes framework. In my implementation I have a driver component that has 7 dataport buf and I connected these buffers to hardware component. In source of component driver I am initialize gpio_sys, mux_sys and pins using these functions: - imx6_mux_init() - imx6_gpio_sys_init() - gpio_new()
Here I have copied some part of my code: ****************************************** gpio_sys_t gpio_sys; gpio_t pins[32*7]; mux_sys_t mux_sys; void gpio__init() { imx6_mux_init(NULL, &mux_sys); imx6_gpio_sys_init((void*)gpio0, (void*)gpio1, (void*)gpio2, (void*)gpio3, (void*)gpio4, (void*)gpio5, (void*)gpio6, &mux_sys, &gpio_sys); } void gpio_init_pin(int pin, int direction) { if(pin>0 && pin< sizeof(pins)/sizeof(pins[0])) { gpio_new(&gpio_sys, pin, (enum gpio_dir)direction, &pins[pin]); } }
void gpio_set_pin(int pin, int value) { if(pin >= 0 && pin < (sizeof(pins)/sizeof(pins[0]))) { if(value) { gpio_set(&pins[pin]); } else { gpio_clr(&pins[pin]); } } }
int gpio_read_pin(int pin) { if(pin>0 && pin< sizeof(pins)/sizeof(pins[0])) { return gpio_get(&pins[pin]); } return -1; } ****************************************** By calling "gpio_init_pin(ALARM_PIN= 28, 0);" I am getting this error: Assertion failed: bank->data == v (PATH/projects/util_libs/libplatsupport/src/plat/imx6/gpio.c: imx6_gpio_write: 144) How can I fix this error? How should I specify the GPIO pins?
Thank you for your time and consideration, Parvaneh.
Hi Parvaneh,
Hello all, I find your response to my question in Dvel Archive. I changed the parameter of gpio_new() that I am calling in my gpio_init_pin() (I changed it from 0 to 1 to have output direction). But I keep getting same error: imx6_gpio_init@gpio.c:96 Invalid GPIO Assertion failed: bank->data == v (libplatsupport/src/plat/imx6/gpio.c: imx6_gpio_set_level: 136) My question is that could it be because of pin number that I pass to gpio_new function. Here I have copied parts of my code: ...
I had a closer look at the drivers and the issue does seem to lie with the pin number that you pass to gpio_new, this causes gpio_new to fail and return an error. From the first email, I see that you pass pin number 28 to the gpio_new function. gpio_new calls a GPIO pin initialisation function, and inside this function it calls another function to mux the GPIO pin so that it is the active pin out of the group of pins in its corresponding pad [1]. Unfortunately, in the GPIO pin mux function we do not have code to mux pin number 28 out [2]. So to resolve your problem, you would have to add an additional switch case to be able to set the bits in the register which controls the pad that pin number 28 is located in. Consider going through page 2028 in the i.MX6Dual/6Quad reference manual as it may be helpful. Sincerely, Damon [1] https://github.com/seL4/util_libs/blob/master/libplatsupport/src/plat/imx6/g... [2] https://github.com/seL4/util_libs/blob/master/libplatsupport/src/plat/imx6/m...
participants (2)
-
Lee, Damon (Data61, Kensington NSW)
-
Parvaneh Ahgajani