November 01, 2024, 02:35:42 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


AP-16+, FC-4 and PROP-1 - SFX audio not playing

Started by Radiowave911, October 13, 2010, 08:30:55 PM

Previous topic - Next topic

JackMan

From original post:

Quote("!AP16", AP16, "PW", "ERUPT", 13, 1)

Just a shot in the dark here cause I'm not really sure but shouldn't the second entry of this command be a Valid address in the range of %00 to %11?


JonnyMac

In his listing 'AP16' is a constant with the value %11.  As a reminder, the address is aligned with the device type.  For simplicity, I tend to use %00 in all my programs unless I have two or more of the same device.
Jon McPhalen
EFX-TEK Hollywood Office

Radiowave911

Thanks, Jon.  I have run the demo code from the web site, and it works fine usig that code with the AP-16+ and FC-4 both connected.  What i was wondering is whether or not I am running into a timing issue with the AP-16+ for some reason.  I am sending serial data to two different devices almost back to back int he program, and was wondering if that was the issue.  As I posted elsewhere in this thread, I am not entirely sure the AP-16+ is receivng the serial commands.  In the docs, it says that even if the file is invalid, the ambient file will be stopped and restarted when the play command is issued.  This does not happen at all when running my program, but does happen with the test program - which is the behavior I would expect from the test program.  I had the test program calling my files on the card, and it ran fine.  I copied the SEROUT code to play the file directly from the demo program into the appropriate place in my program and got nothing.

One thing I see in your program is an initialization delay.  I have no such delay in my program.  Is that something you just do, or is it a requirement for the AP-16+?

JonnyMac

Mea culpa (since I wrote the AP-16+ firmware).  Turns out you were right vis-a-vis back-to-back comms.

I verified by changing the test code above like this:

Test_Play:
  SEROUT Sio, Baud, ("!FC4", %00, "S", 0, 0, 0, 0)
  SEROUT Sio, Baud, ("!AP16", %11, "PW", "SFX00", 13, 1)


After adding the FC-4 command the AP-16+ play command stopped working.  Diving into the AP-16+ code I found that the buffer setting on the serial object was way too small.  That has been corrected in the attached version and the code above now works.

Before I release this "officially" I hope that you'll give it a try.  Unzip the attached file and then copy it to your SD card.  To update the AP-16+ you'll need to rename the file "AP16.PGM"  When you power up the AP-16+ the status LED will flash yellow for about 15 seconds to let you know the firmware is being updated.  When that's done the AP-16+ will reset itself and you should be ready to go.

Please let me know if this works.  I'm sorry that this has caused you an inconvenience and do appreciate you reporting details so that we could improve the AP-16+ firmware.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

QuoteOne thing I see in your program is an initialization delay.  I have no such delay in my program.  Is that something you just do, or is it a requirement for the AP-16+?

The AP-16+ takes a couple seconds to fully initialize so it might miss a message if you try to talk to it too soon after power up.  Now, most of the delay is it scanning files (the AP-16 builds tables for the known file types on power-up).  The serial object is loaded last but is probably ready to received data within 250ms of power-up.  Since the AP-16+ uses a dedicated processor for handling serial, and now has a buffer of 64 bytes, anything coming in 250ms or so after power up should be captured and handled after the big initialization tasks finish.
Jon McPhalen
EFX-TEK Hollywood Office

Radiowave911

I will try the new code when io get home from work in about 2 or 3 hours from now and report back.  I already have my backup plan mapped out, in case this does not fix the problem, though.  It is my intention to leave the workshop with a fully functional deathstarvolcano :)

Radiowave911

I have it working!  I did install the new firmware, however that alone did not fix it.  I added a PAUSE 1000 before sending the serial command to the AP-16+, that is what finally made it work.  I am wondering if the FC-4 is doing something on the serial line after it's update that keeps the command from going to the AP-16+.  The pause value was a somewhat arbitrary number.  If I have time, I will play with it to determine a minimum value, however I still have to do a full load/runtime test to determine how long it will run before the battery dies.  If it is not at LEAST 90 minutes, I need a bigger/secondary battery.

JonnyMac

QuoteI am wondering if the FC-4 is doing something on the serial line after it's update

No, it only responds to the "V" and "G" commands, and to be double-dog sure I cracked open the FC-4 source code and double-checked.  And as you saw in my example above, I am sending back-to-back commands without trouble.

Your program is to the rafters and I'm wondering if that isn't having some kind of ill effect on the program.  I always get nervous when I'm at 0 bytes of program space left.
Jon McPhalen
EFX-TEK Hollywood Office