Esko Laaksonen

MCf-5282 QADC-module working as gpio-ports

Discussion created by Esko Laaksonen on Sep 13, 2007
Latest reply on Sep 24, 2015 by TomE
Hi,
I have mcf5282 mounted on sodimm carrier (som5282) and uclinux running in it.
There are lot of gpios in mcf5282, but those I want to use are hard to utilize.
I wuold like to use QADC-module ports as digital I/O.
The user manual says that those ports are configured with Port QA Data Direction Register and Port QB Data Direction Register. Then ports are readable/writable through Port QA Data Register and Port QB Data Register. UM says also that the registers are IPSBAR + 0x19_00xx. I suppose that means 0x190000 and not 0x19000000.

Code:
#define IPSBAR 0x40000000#define QADC      IPSBAR + 0x190000#define PORTQ     IPSBAR + 0x190006#define DDRQ      IPSBAR + 0x190008unsigned short int hword = 0;unsigned short int *ptr;unsigned short int temp = 0;ptr = (unsigned short int*)QADC;memcpy(&hword,ptr,2);printf("QADCR %X\n",hword);ptr = (unsigned short int*)DDRQ;temp = 0x1B00 // ports a configured as ouput and ports b inputmemcpy(ptr,&temp,2);

It just gives SIGSEGV. So are those memory addresses valid after all?
And how this QADC-module can be configured as digital I/O module?




Outcomes