Author Topic: Nspire Audio player!  (Read 54615 times)

0 Members and 1 Guest are viewing this topic.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: Nspire Audio player!
« Reply #45 on: March 07, 2013, 01:25:06 am »
Everytime the (fast)timer fires an fiq, I toggle gpio 4 and set the timer value.
For instance, if pwm=40, I set the timer to 40, after toggling I set the timer to (256-40).
So I get a pwm freq of about 33000000/256 Hz, but for whatever reason I have to shift the timef value one left. If pwm is updated while the gpio is on, the off period is already computed with the new value, so it should atleast feel faster :)

SD card support might be good for nspire-linux, the usb port is slow as hell.
« Last Edit: March 20, 2013, 05:53:39 pm by Vogtinator »

Offline Tremled

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +0/-0
    • View Profile
Re: Nspire Audio player!
« Reply #46 on: March 18, 2013, 12:31:47 pm »
Just wondered... wouldn't it be possible to have a stereo-signal coming out? As far as I know there are other pins at the dock-connector that could be used for something like that.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: Nspire Audio player!
« Reply #47 on: March 18, 2013, 12:41:10 pm »
Yes it would be possible, but we only have two 33 MHz timers (for pwm), we would have to use the 33 kHz timer as sample update.
That would mean wav loading is impossible (if they're not 33kHz) or it'd sound weird. Mono is noisy enough (8 bit).
But one thing is interesting, with some resistors and two GPIOs it's possible to do 16 bit pwm, but that would destroy the simplicity :-/

Offline Tremled

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +0/-0
    • View Profile
Re: Nspire Audio player!
« Reply #48 on: March 18, 2013, 12:54:08 pm »
Isn't it possible to set the pwm-values for both the left and the right channel using the same timer, thereby enabling wav-loading even though it's stereo (by using the faster timer)?

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: Nspire Audio player!
« Reply #49 on: March 18, 2013, 12:55:57 pm »
How would you do that? You're only able to execute 132/33=4 cpu cycles each timer interrupt (and the JMP already needs 5)
« Last Edit: March 18, 2013, 12:59:42 pm by Vogtinator »

Offline Tremled

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +0/-0
    • View Profile
Re: Nspire Audio player!
« Reply #50 on: March 18, 2013, 01:13:32 pm »
Too bad; using the same timer for both channels apparently isn't a solution.  :(

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: Nspire Audio player!
« Reply #51 on: March 18, 2013, 01:16:53 pm »
Exactly, the calc is too slow..
But it would work on the older (non-cx) models, they actually have 6 33MHz timers Second timer, but I don't have one :-(

Offline l6979630

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
    • View Profile
Re: Nspire Audio player!
« Reply #52 on: June 27, 2014, 11:32:06 pm »
I have a Ti-nspire CAS non-CX.I try to modify your code to make it work on my Ti-nspire.But It always resets when it registers FIQ handler.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Nspire Audio player!
« Reply #53 on: June 28, 2014, 03:29:08 am »
If you posted the changes you made it would probably help. Also which OS are you running ?

Offline l6979630

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
    • View Profile
Re: Nspire Audio player!
« Reply #54 on: June 28, 2014, 05:50:49 am »
I just deleted the part to check OS.It doesn't works on 3.1 or 3.6.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: Nspire Audio player!
« Reply #55 on: June 28, 2014, 09:00:00 pm »
The non-cx hardware is entirely different, so you'd need to rewrite the asm code and the timer setup code in audio.c almost completely.
It shouldn't be too hard, though, as only the bit positions, register layout and clock speeds changed.
« Last Edit: June 28, 2014, 09:02:47 pm by Vogtinator »

Offline l6979630

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
    • View Profile
Re: Nspire Audio player!
« Reply #56 on: June 28, 2014, 10:30:10 pm »
It's too hard to me to rewrite the asm code.I even don't know its meaning.Could you help me?

Offline l6979630

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
    • View Profile
Re: Nspire Audio player!
« Reply #57 on: June 28, 2014, 10:58:04 pm »
When i delete asm code in interrupt.c it has some problem,but it doesn't reset again.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: Nspire Audio player!
« Reply #58 on: June 29, 2014, 06:50:33 am »
Don't double post, the "edit" button has a meaning ;)

Quote
It's too hard to me to rewrite the asm code.I even don't know its meaning.Could you help me?
I literally commented every instruction.. Except for some basic blocks. BTW: You can replace the "unaligned read at r9" by a simple "ldrb r9, [r9]".
But you definitely need to understand it well enough to make such a rewrite.

Quote
When i delete asm code in interrupt.c it has some problem,but it doesn't reset again.
Which asm code in interrupt.c?

Offline l6979630

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
    • View Profile
Re: Nspire Audio player!
« Reply #59 on: July 03, 2014, 09:49:26 am »
I try to modify memory-mapped in interrupt.c.Then there is not error in log window.But it still resets. :banghead:
« Last Edit: July 03, 2014, 09:52:36 am by l6979630 »