Hello,
I am trying to use GPIO0.09 dr_toggle, dr_set and dr_clear registers on Toradex Apalis imx8qm board running QNX70.
Direct writing to the GPIO0 data register DR works fine. But neither dr_set, dr_clear nor dr_toggle work. I am using the code below.
Thank you.
#define GPIO0_BASE 0x5d080000
#define GPIO2_MASK 0x200
#define DR 0x00
#define GDIR 0x04
#define DR_SET 0x84
#define DR_CLR 0x88
#define DR_TOG 0x8C
int gpio_check(void)
{
// bump priority for scheduling the event
pthread_setschedprio( pthread_self(), HIGH_PRIO );
ThreadCtl( _NTO_TCTL_IO, 0 );
ptr_reg = mmap_device_io(0x400, GPIO0_BASE );
printf ("VG\n");
x0 =in32(ptr_reg+GDIR);
out32(ptr_reg+DR, GPIO2_MASK );
out32(ptr_reg+DR, 0 ); // GPIO pin is low
out32(ptr_reg+DR, GPIO2_MASK ); // GPIO pin is high
out32(ptr_reg+DR_SET, GPIO2_MASK ); // GPIO pin doesn't change
out32(ptr_reg+DR_CLR, GPIO2_MASK ); // GPIO pin doesn't change
out32(ptr_reg+DR_TOG, GPIO2_MASK ); // GPIO pin doesn't change
}
Hi vg53
one can look at toradex apalis gpio forum :
https://www.toradex.com/community/questions/37590/gpio-access-apalis-imx8qm.html
http://variwiki.com/index.php?title=MX8_GPIO
Best regards
igor
Hi Igor,
I forgot to mention in my reply that I did look at the Toradex references you provided, they are not relevant to my question.
We are using GPIO pins for instrumenting high speed routines. Now we have to use a sequence of read-modify-write to change an output pin, it takes about 1us. I hope it would be a lot faster if we can use DR_SET, DR_CLEAR registers.
Could you please answer my question: are the GPIO registers (DR_SET, .. DR_TOGGLE) operational in the iMX8QM? If they are, how should we use them?
Thank you.
Hi Igor,
I can change the state of GPIO0.2 pin by writing to data register DR directly. What I failed to do is change the state of the pin by writing to DR_SET, DR_CLEAR and DR_TOGGLE registers, see attached.
My question is: are these registers (DR_SET, .. DR_TOGGLE) operational in the iMX8?
Thank you.
On i.mx8qxp for me set works, clear and toggle don't. The datasheet only mentions them in the register map, it's not in the description. If it's not wired up they should remove all mentions of those registers from the datasheet.