#169972 - littlestone - Thu Aug 20, 2009 8:55 am
I write a little program,a command is sent from arm9 to arm7.It seems than the arm7 processor cann't receive the command.My program is as below:
ARM9 Side:
main(void)
{
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE |IPC_FIFO_SEND_CLEAR;
while(true){
if(KEY_A){
if(REG_IPC_FIFO_CR & 1){
//if Send Fifo Empty ,send this command
IPCFIFOSEND=command;
prinf("send command success\n"):
}else{
prinf("send fifo not empty\n"):
printf("REG_IPC_FIFO_CR :0x%x\n",REG_IPC_FIFO_CR );
REG_IPC_FIFO_CR|=8;
printf("REG_IPC_FIFO_CR :0x%x\n",REG_IPC_FIFO_CR );
}
}
}
}
ARM7 Side:
main(void)
{
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE |IPC_FIFO_SEND_CLEAR;
while(true){
if(!(REG_IPC_FIFO_CR & 0x100)){
//if Receive Fifo Empty ,get the command
u32 msg=IPCFIFORECV;
}
}
}
run this program on nds and press keya continuely,it always prinf as below:
press keya for the first time:
printf:
send command success
press keya for the second time:
prinf:
send fifo not empty
REG_IPC_FIFO_CR :0x8100
REG_IPC_FIFO_CR :0x8101
press keya for the third time:
printf:
send command success
press keya for the fourth time:
prinf:
send fifo not empty
REG_IPC_FIFO_CR :0x8100
REG_IPC_FIFO_CR :0x8101
It seems that arm7 processor can't receive the command?Anybody meets this problem before?What's this reason?
#169973 - Echo49 - Thu Aug 20, 2009 9:28 am
Have you tried the wrapper functions for FIFO?
#169974 - littlestone - Thu Aug 20, 2009 9:37 am
hi,echo49.
I just cann't understand why arm7 cann't receive the command from arm9?Is it possible the arm7 breakdown while the arm9 processor is till running?
#169979 - elhobbs - Thu Aug 20, 2009 1:40 pm
as echo49 pointed out - you need to use the fifo functions provided by libnds. or you need to completely disable the libnds fifo code and use your own - which will take more code than what you provided. keep in mind the libnds fifo code is used by sound, wifi, touch, and X/Y keys to name a few. so ditching it is not trivial.
#169982 - littlestone - Thu Aug 20, 2009 3:36 pm
http://www.double.co.nz/nintendo_ds/nds_develop7.html
I just want to write a sound program. And I learn from this tutorial given above.I found this sample cann't run on my nds. In the end,I found the reason is arm7 processor cann't receive the command from the arm9 processor. Is it possible some arm9 registers are not set correctly?Therefore, the arm7 processor cann't access IPC register.
#169983 - MH6 - Thu Aug 20, 2009 3:44 pm
Have you tried using MaxMod? It handles sound for you, and is insanely easy to use.
#169984 - elhobbs - Thu Aug 20, 2009 3:58 pm
littlestone wrote: |
http://www.double.co.nz/nintendo_ds/nds_develop7.html
I just want to write a sound program. And I learn from this tutorial given above.I found this sample cann't run on my nds. In the end,I found the reason is arm7 processor cann't receive the command from the arm9 processor. Is it possible some arm9 registers are not set correctly?Therefore, the arm7 processor cann't access IPC register. |
yes, you are correct. The registers are not set correctly for what you are trying to do. However, they are set 100% correctly to use the libnds fifo system. any reason you are ignoring suggestions to use the libnds fifo system?
#169985 - vuurrobin - Thu Aug 20, 2009 4:04 pm
littlestone wrote: |
http://www.double.co.nz/nintendo_ds/nds_develop7.html
|
I click the link, and the first thing I see is:
Quote: |
This tutorial was tested and works with libnds dated 2005-10-18. Unfortunately it no longer works with libnds dated 2005-12-12. I'm looking into it. |
it also is part of the 'Old Tutorials', according to the top table. seems to me that that tutorial is very outdated.
I also believe that the ipc is depricated.
#169986 - littlestone - Thu Aug 20, 2009 4:13 pm
elhobbs and vuurrobin, thanks a lot.
This sample works well on no$gba.But it cann't work on my nds.I cann't find the reason.As we all know, when this program runs on no$gba,all arm7 and arm9 processor registers are in reset state before this program runs.But when I run this program on nds, the arm registers have been set by the loader . Is it possible, other registers can affect IPC bewteen arm7 and arm9? Besides, I have tested libnds and met the same question.
#169987 - elhobbs - Thu Aug 20, 2009 5:49 pm
littlestone - you are just kidding at this point, right?
#169994 - littlestone - Fri Aug 21, 2009 1:05 am
elhobbs,I'm not kidding.In fact,I'm puzzled at this question now.I have made a search in the forum and I found somebody else met the same question as me.Unfortunately, nobody gave a good explanation.I believe some registers(not IPC registers) can affect the IPC between arm7 and arm9.Till now,I do not find this register.
#169996 - vuurrobin - Fri Aug 21, 2009 2:03 am
I doubt the problem lies with some register.
littlestone, why do you want to use the IPC.
#169997 - elhobbs - Fri Aug 21, 2009 2:12 am
libnds initializes the fifo system prior to your main function ever being called. since libnds has already setup the fifo it is no longer configured to work the way you are trying to use it. writing to the fifo registers probably just messes it up. however, it does not mean you cannot use fifo. you just need to use the api that libnds provides.
did you look at the link that echo49 provided? you should as this will provide the answers you are looking for.
in particular you could use fifoSetValue32Handler which establishes a callback handler to receive data. once that has been set then you can use fifoSendDatamsg to send data. so you would want to set the callback on the destination processor then send from the source processor.
#170000 - littlestone - Fri Aug 21, 2009 6:47 am
I found the arm7 processor crashed.It's not the IPC question.Thanks for all.It may be difficult for me to solve this problem.
#170001 - littlestone - Fri Aug 21, 2009 6:49 am
Who can give some suggestion?My program runs well on no$gba.When running on nds,the arm7 crashed.It's the responsibility of the loader?
#170002 - Echo49 - Fri Aug 21, 2009 7:42 am
What flashcart are you using?
#170005 - littlestone - Fri Aug 21, 2009 11:50 am
R4
#170006 - sverx - Fri Aug 21, 2009 11:54 am
littlestone wrote: |
Who can give some suggestion?My program runs well on no$gba. |
It reminds me of this post of AngunaDS dev blog: Nathan noticed that there was some kind of "garbage" passed thru the FIFO on a real DS, there wasn't any on no$gba.
btw all that is pre-1.3.1 ndslib era, when there weren't functions to do that easily...
#170007 - Echo49 - Fri Aug 21, 2009 12:08 pm
I had problems with the ARM7 locking up when the flashcart is a CycloDS, but not with Supercard or R4. But this was back with r25.
#170009 - gauauu - Fri Aug 21, 2009 3:10 pm
sverx wrote: |
It reminds me of this post of AngunaDS dev blog: Nathan noticed that there was some kind of "garbage" passed thru the FIFO on a real DS, there wasn't any on no$gba.
|
Heh, I had forgotten about that. I saw your post and thought, "ME? I had that problem?" Turns out I have a bad memory....
But yeah, I never figured out WHAT was sending messages through the FIFO....maybe the card's loader or something? It seemed to only happen right when you first started the game. But sanity checking to make sure the message actually fit my message format fixed the issue.
#170010 - sverx - Fri Aug 21, 2009 4:29 pm
gauauu wrote: |
[...]I never figured out WHAT was sending messages through the FIFO....maybe the card's loader or something? |
I don't know, I never experienced that with my setup... I was using a (very simple) custom FIFO scheme, in that pre-1.3.1 era. I was passing a pointer (so it was simply a 32 bit value) from the ARM9 and I was receiving it correctly on the ARM7. ZERO meant 'stop playing', any other value meant 'start playing song stored at that address'.
Worked both on no$gba and on my NDS Lite + R4 with no troubles. So I also really don't know. But, ok, it's gone ;)
Bye! :D