I have a big problem.
I need to get access to 2 digital inputs and 2 digital outputs.
I can see in the specification of my board ( HiCo SH7760 ) that it has multiple number of GPIO but I can’t find anywhere information on how to access them.
I know I could do it with mmap_device_io but I don’t know the address
Please HELP!
Well not really to be honest but Thanks anyway.
I managed to push my code a little bit forward but again I’m stuck:
[color=green]//Two variables for storing the port of the
//PORTA which is the GPIO I’m interested in (8bit)
[color=blue]uintptr_t PORTAtemp;
[color=green]//PACR which is the configuration register for PORTA(16bit)
[color=blue]uintptr_t PACRtemp;
[color=blue]ThreadCtl(_NTO_TCTL_IO,0);
[color=green]//I map them to the address I found in the sh7760 specification
//(but I’m nor sure whether the values were not change by the BSP
//though it seams that the PACR address is OK )
[color=blue]PORTAtemp = mmap_device_io(0x8 , 0xFE400080);
PACRtemp = mmap_device_io(0x10 , 0xFE400000);
[color=green]//I’m setting some pins to the outputs
[color=blue]out16( PACRtemp , 0x5550);
[color=green]//I’m writing FF to the port
[color=blue]out8( PORTAtemp, 0xFF);
Results are following:
If I configure it as an output I got all 0V on the port.
If I configure it as a Input Pull-up ON its all about 3.3V
So It seams to work.
But If I write to a port using [color=blue]out8(PORTAtemp, 0xFF);
the is no results nothing happens.
Don’t know what could be wrong
Any ideas anyone?
Ok found it! Sorry for this post - hope that at least in the future someone will use this:
The address was wrong:
should be:
[color=blue]PORTAtemp = mmap_device_io(0x8 , 0xFE400040);