Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Buleste
Posts: 43
Joined: Sun Nov 06, 2016 12:19 pm

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by Buleste » Sat Feb 04, 2017 10:42 am

BennehBoy wrote:Can't you write to the SD? (not withstanding the level shifting issues on your existing reader, but I mean as an alternative to having to incorporate a physical eeprom)
There's no reason as to why I can't.
Good idea.
That's why I need other people to do the thinking for me. I get so stuck in my own ways I fail to see the other possibilities.

User avatar
BennehBoy
Posts: 420
Joined: Thu Jan 05, 2017 8:21 pm
Location: Yorkshire
Contact:

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by BennehBoy » Sat Feb 04, 2017 11:15 am

Buleste wrote: There's no reason as to why I can't.
Good idea.
That's why I need other people to do the thinking for me. I get so stuck in my own ways I fail to see the other possibilities.
:ugeek:
-------------------------------------
https://github.com/BennehBoy

Buleste
Posts: 43
Joined: Sun Nov 06, 2016 12:19 pm

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by Buleste » Thu Feb 16, 2017 3:40 pm

Humbug. New Maple Mini arrived today and I've managed to upload Bootloader 2.0 to it but when I plug it into the USB I get no COM Port popping up in Device manager so I can't programme it. Time to figure out whats wrong with it.

stevestrong
Posts: 1447
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by stevestrong » Thu Feb 16, 2017 4:02 pm

You don't need the COM port to flash it. The uploader will detect the USB DFU port and will program the chip.
The COM port appears after the first program has been flashed, so that serial USB is active.

Buleste
Posts: 43
Joined: Sun Nov 06, 2016 12:19 pm

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by Buleste » Thu Feb 16, 2017 4:50 pm

stevestrong wrote:You don't need the COM port to flash it. The uploader will detect the USB DFU port and will program the chip.
The COM port appears after the first program has been flashed, so that serial USB is active.
Ah. Okay. Thanks for that.
Working now.

Buleste
Posts: 43
Joined: Sun Nov 06, 2016 12:19 pm

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by Buleste » Wed Mar 01, 2017 2:21 pm

Finally my new sd card readers are here and SD cards are being detected etc.

Sadly it looks like my alterations to my projects code haven't worked and I haven't been able to get the wav player to play wavs either yet but time to crack on.

User avatar
BennehBoy
Posts: 420
Joined: Thu Jan 05, 2017 8:21 pm
Location: Yorkshire
Contact:

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by BennehBoy » Wed Mar 01, 2017 4:44 pm

Is your code on github?
-------------------------------------
https://github.com/BennehBoy

Buleste
Posts: 43
Joined: Sun Nov 06, 2016 12:19 pm

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by Buleste » Wed Mar 01, 2017 5:20 pm

Sadly not. MapleTape which uses the TMRpcm library by Victor plays garbled sound which is a start.

TZXMaple and CASMaple don't play any sound and I think that's due to the timer. The Arduino code used Timer1 Library and I've tried to change the functions to HardwareTimer library and they just aren't the same.

MapleTape zip https://mega.nz/#!vVNlDTwT!ro5dbqHEGdfv ... ew9tCo7SHo
CASMaple zip (Plays MSX .CAS files) https://mega.nz/#!bUkhBCzB!lvNOBlQaIp1a ... Yk47Nxus2w
TZXMaple zip (plays ZX Spectrum TRZ/TAP files) https://mega.nz/#!6Md1hTDI!5rk7c6fWwChG ... dioJGyDB0E

I also converted CoOS Wav Player setModule2 to work with an ILI9341 changing only the TFT code but it doesn't seem to be able to search for .WAV files on the SD card as it did in the original even though I didn't actually mess with that part of the coding.

victor_pv
Posts: 1472
Joined: Mon Apr 27, 2015 12:12 pm

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by victor_pv » Wed Mar 01, 2017 5:53 pm

Buleste wrote:Sadly not. MapleTape which uses the TMRpcm library by Victor plays garbled sound which is a start.

TZXMaple and CASMaple don't play any sound and I think that's due to the timer. The Arduino code used Timer1 Library and I've tried to change the functions to HardwareTimer library and they just aren't the same.

MapleTape zip https://mega.nz/#!vVNlDTwT!ro5dbqHEGdfv ... ew9tCo7SHo
CASMaple zip (Plays MSX .CAS files) https://mega.nz/#!bUkhBCzB!lvNOBlQaIp1a ... Yk47Nxus2w
TZXMaple zip (plays ZX Spectrum TRZ/TAP files) https://mega.nz/#!6Md1hTDI!5rk7c6fWwChG ... dioJGyDB0E

I also converted CoOS Wav Player setModule2 to work with an ILI9341 changing only the TFT code but it doesn't seem to be able to search for .WAV files on the SD card as it did in the original even though I didn't actually mess with that part of the coding.
I was using my wav player to test changes to the SPI library, and found some unrelated bugs in the tmrpcm code.
This chunk of code is using "=" rahter than "==" for the comparisons, so it mess up the sampling rate:

Code: Select all

  	#endif
  	}
	if(TMRpcm_sample_RATE = 48000 ){
		resolution = 260; //250
		repetition = 5;
	}
	else if(TMRpcm_sample_RATE = 44100 ){
		resolution = 285; //272
		repetition = 5;
	}
	else if(TMRpcm_sample_RATE = 22050 ){
		resolution = 285; //272
		repetition = 11;
	}
	else if(TMRpcm_sample_RATE = 8000 ){
		resolution = 260; //250
		repetition = 35;
	}
	else {
		resolution = 72000000/TMRpcm_sample_RATE;
		repetition = resolution/256;
		resolution = resolution/repetition;
		repetition = repetition-1;
	}

	#if defined (debug)
  	  	Serial.println("Peeking tmp byte ");
  	#endif
Change the "if" statements to use ==, that will help ("TMRpcm_sample_RATE = " to "TMRpcm_sample_RATE == ")

Buleste
Posts: 43
Joined: Sun Nov 06, 2016 12:19 pm

Re: Problems with converting Arduino Nano code over to Maple Mini. Help needed.

Post by Buleste » Wed Mar 01, 2017 7:02 pm

Thanks Victor
Okay changed to the following.

Code: Select all

if(TMRpcm_sample_RATE > 48000 ){ TMRpcm_sample_RATE = 48000;
	#if defined (debug)
  	  	Serial.print("TMRpcm_sample RATE TOO HIGH: ");
  	  	Serial.println(TMRpcm_sample_RATE);
  	#endif
  	}
	if(TMRpcm_sample_RATE == 48000 ){
		resolution = 260; //250
		repetition = 5;
	}
	else if(TMRpcm_sample_RATE == 44100 ){
		resolution = 285; //272
		repetition = 5;
	}
	else if(TMRpcm_sample_RATE == 22050 ){
		resolution = 285; //272
		repetition = 11;
	}
	else if(TMRpcm_sample_RATE == 8000 ){
		resolution = 260; //250
		repetition = 35;
	}
	else {
		resolution = 72000000/TMRpcm_sample_RATE;
		repetition = resolution/256;
		resolution = resolution/repetition;
		repetition = repetition-1;
	}
Made those changes and still no joy playing wavs.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests