#52024 - Tomik - Thu Aug 25, 2005 4:38 pm
Hello, thanks first for all the help! Everything works fine right now.
My next wish is ti bring an external SinusSignal into the GBA. Thatfore I use a ADC ! So I need:
1: A External Clock at my GBA SP (PHIP)
2: A Adresse(A[23..16]) for reading in the 16-bits !
Can someone help me, with tipps or links with help inside ??
Thanks, Thomas (Hamburg/Germany)
#52027 - Tomik - Thu Aug 25, 2005 4:58 pm
I forget to say I want to work iwith a multiplexed bus. how can i chhose this?
FG, T
#52037 - tepples - Thu Aug 25, 2005 7:18 pm
If this is still being sold, it's probably pretty close to what you want.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#52083 - Tomik - Fri Aug 26, 2005 7:47 am
yes, i know, but i want to make it by myself.
i want to make a non-gaming application.
do you know how give a myself-defined Value to the A[16-23] pins, like 0xFF ??
Thomas
#52101 - tepples - Fri Aug 26, 2005 6:12 pm
The GBA cart bus protocol divides ROM into 128 KiB banks. Normally this is transparent to the programmer.
To set the A[16..23] pins to a given value, write to that numbered 128 KiB bank.
Code: |
#define KiB *1024
#define READ_A16(x) (*(volatile u16 *)(0x08000000+(x)*(128 KiB)))
int x = READ_A16(0x23);
int y = 0xF001;
WRITE_A16(0x45) = y;
|
It might prove easier to use the SRAM bus protocol, which puts an address on AD[0..15] and 8-bit data on A[16..23].
Code: |
#define SRAM ((volatile u8 *)0x0E000000) |
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#52301 - Tomik - Mon Aug 29, 2005 2:33 pm
thanks first, this is just for right understanding:
..and yes, I need the 16bits for data, because the ADC is 12 Bit and I need them all !
#define KiB *1024
#define READ_A16(x) (*(volatile u16 *)(0x08000000+(x)*(128 KiB)))
int x = READ_A16(0x23);
int y = 0xF001;
WRITE_A16(0x45) = y;
you multiply to a "self-given" value (here: 0x23) the 128KB and add them to them GAME PAK Memory! READ_A16 = 0x08460000 . the next possible Adress would be 0x08480000! right?
i just ask because i found a source code, where 256KB steps and not
128KB are made. that means half adress combinations !
for what is this:
int y = 0xF001;
WRITE_A16(0x45) = y;
thanks a lot for your help tepples !!
Thomas
#52312 - Tomik - Mon Aug 29, 2005 4:27 pm
..and the next question is:
How can I read in the Data from AD[0..15] ?
I put this adress on A[16-23] in my MAIN-LOOP and then I want to put this 16Bit value in a register to work with it...but how ??
Thomas
#52398 - tepples - Tue Aug 30, 2005 2:11 pm
Tomik wrote: |
thanks first, this is just for right understanding:
..and yes, I need the 16bits for data, because the ADC is 12 Bit and I need them all ! |
Can you put latches around the ADC so that 0x0E000000 gives part of the word and 0x0E000001 gives the other part?
Quote: |
#define KiB *1024
#define READ_A16(x) (*(volatile u16 *)(0x08000000+(x)*(128 KiB)))
int x = READ_A16(0x23);
int y = 0xF001;
WRITE_A16(0x45) = y;
you multiply to a "self-given" value (here: 0x23) the 128KB and add them to them GAME PAK Memory! READ_A16 = 0x08460000 . the next possible Adress would be 0x08480000! right? |
Yes.
Quote: |
i just ask because i found a source code, where 256KB steps and not
128KB are made. that means half adress combinations ! |
It might have been for controlling some specific on-cart circuitry that doesn't use A16.
Quote: |
for what is this:
int y = 0xF001;
WRITE_A16(0x45) = y; |
That writes 0x45 to A16-A23 and 0xF001 to AD0-AD15.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#52521 - Tomik - Wed Aug 31, 2005 2:05 pm
what about question #1 ??
how can i put the clock on the PHIP PIN ??
Thomas
#52527 - Tomik - Wed Aug 31, 2005 3:35 pm
unbelieveable .. i did find it by myself !!
its Address: 0x4000204
0123 4567 89AB CDEF
BC are the intersting ones, right ??
what should i do with the rest ??
Thomas
#52610 - Tomik - Thu Sep 01, 2005 11:12 am
why does this NOT work ??
u16 *adresspointer = (u16*)0x4000204; // 4MHz Output
adresspointer=0x0800;
Thomas
#52611 - chishm - Thu Sep 01, 2005 11:46 am
I'm pretty sure you have to dereference the address pointer using Code: |
*adresspointer=0x0800; |
#52615 - Tomik - Thu Sep 01, 2005 11:55 am
yes that is correct, but do i have to do now ?
#52738 - Tomik - Fri Sep 02, 2005 5:03 pm
Hi,
ok clock is working fine, but I still cannot readout my ADC.
Do you know where I made the mistake??
Code: |
#define KiB *1024
#define READ_ADR(x) (*(volatile u16 *)(0x08000000+(x)*(128 KiB)))
main{}
void Pixel(int *yArr) // Plot current value and scroll
{
int i;
int xAXIS=120;
for(i=120; i>0 ; i--)
{
PlotPixel(xAXIS,yArr[i],0x0000);
yArr[i-1]=yArr[i-2];
xAXIS=xAXIS-1;
}
if(yArr[0])
{
ADC_CNT(yArr);
}
}
void ADC_CNT(int *yArr) // move random value to yArr[0]
{
int yValue;
int shiftadc;
int adcvalue = READ_ADR(0x4E);
shiftadc= adcvalue << 5;
yValue=(int) ((-0.923*shiftadc+140)+0.5);
yArr[0]=yValue;
}
|
#52977 - Tomik - Mon Sep 05, 2005 7:48 am
..nobody can help me ???
Thomas / Hamburg
#52982 - Tomik - Mon Sep 05, 2005 8:37 am
this also doesnt work:
Code: |
u16* ReadADC =(u16*)0x089C0000;
main{}
void ADC_CNT(int *yArr)
{
int adcvalue = *ReadADC;
......
yArr[0]=yValue;
}
|
why?
#53008 - Tomik - Mon Sep 05, 2005 1:43 pm
@tepples:This does NOT work:
tepples wrote: |
Code: |
#define KiB *1024
#define READ_A16(x) (*(volatile u16 *)(0x08000000+(x)*(128 KiB)))
int x = READ_A16(0x23);
|
|
Do you have another idea, or an idea why it doesn?t work ??
Thomas