Hmm, then you are at wrong forum. This is about PicBasic Pro compiler. Not the C compiler of any company.
Ioannis
Hmm, then you are at wrong forum. This is about PicBasic Pro compiler. Not the C compiler of any company.
Ioannis
Ioannis,
I'm not a fan of those who stray off topic and don't pay attention to forum etiquette. More of my concern was whether or not any of you were able to use your PICs and the actual SPI hardware in them. Or did all of you "bit bang" to communicate?
Thanks, Alan
I implemented hardware SPI using a PIC 16F877A and an ISD1740. I do it with ASM, but you can translate it to PICBasic if needed.
I'm posting it here because is the most extensive thread in the subject I could found, and I haven't found information about how to do it by hardware anywhere. I haven't finish yet, but I will probably forget to post it here late, so here goes what I've done so far.
As PIC SPI is Msb -> Lsb and ISD1700 is Lsb -> Msb, everything is inverted.
Sorry for the code format, I couldn't find a way to post it properly formatted.Code:ISD commands: ;ISD led active on all the commands, for debugging, set bit 3 to 0 to disable ISD led flashing CONSTANT SND_CMD_PU = b'10001000' CONSTANT SND_CMD_SET_PLAY = b'00001001' CONSTANT SND_CMD_SET_REC = b'10001001' CONSTANT SND_CMD_PD = b'11101000' CONSTANT SND_CMD_CLR_INT = b'00101000' CONSTANT SND_CMD_WR_APC2 = b'10101110' CONSTANT SND_CMD_WR_NVCFG = b'01101010' CONSTANT SND_CMD_RD_STATUS = b'10101000' ;PIC ISD ports and pins CONSTANT SND_PUERTO_ES = PORTC CONSTANT SND_CONTROL_ES = TRISC CONSTANT SND_PIN_E = .4 CONSTANT SND_PIN_S = .5 CONSTANT SND_PUERTO_CLK = PORTC CONSTANT SND_CONTROL_CLK = TRISC CONSTANT SND_PIN_CLK = .3 CONSTANT SND_PUERTO_SS = PORTA CONSTANT SND_CONTROL_SS = TRISA CONSTANT SND_PIN_SS = .5 ;SPI configuration and activation ;PORTS config banksel SND_CONTROL_ES BCF SND_CONTROL_ES,SND_PIN_S BSF SND_CONTROL_ES,SND_PIN_E banksel SND_CONTROL_CLK BCF SND_CONTROL_CLK,SND_PIN_CLK banksel SND_PUERTO_ES BCF SND_PUERTO_ES,SND_PIN_S banksel SND_PUERTO_CLK BSF SND_PUERTO_CLK,SND_PIN_CLK ;SPI config banksel PIE1 BSF PIE1,SSPIE ;enable interrupt banksel SSPSTAT MOVLW b'00000000' MOVWF SSPSTAT ;SSPM3:0 = 0001 = Fosc/16 banksel SSPCON MOVLW b'00110001' MOVWF SSPCON ;use SS to signal command start/stop banksel SND_CONTROL_SS BCF SND_CONTROL_SS,SND_PIN_SS banksel SND_PUERTO_SS BSF SND_PUERTO_SS,SND_PIN_SS ;SPI usage if not using interrupts ;active waiting for SPI transmission to end snd_debug_esperar banksel SSPSTAT BTFSS SSPSTAT,BF GOTO snd_debug_esperar BCF SSPSTAT,BF RETURN ;SPI without interrupts, to verify it works snd_debug ;it has to be already configured, I'm ignoring ISD response banksel SND_PUERTO_SS BCF SND_PUERTO_SS,SND_PIN_SS ;start command banksel SSPBUF MOVLW SND_CMD_PU ;first byte MOVWF SSPBUF CALL snd_debug_esperar banksel SSPBUF MOVFW SSPBUF CLRW MOVWF SSPBUF call snd_debug_esperar banksel SND_PUERTO_SS BSF SND_PUERTO_SS,SND_PIN_SS ;enviar un SET_PLAY pagesel snd_debug banksel SND_PUERTO_SS BCF SND_PUERTO_SS,SND_PIN_SS MOVLW SND_CMD_SET_PLAY banksel SSPBUF MOVWF SSPBUF CALL snd_debug_esperar banksel SSPBUF MOVFW SSPBUF CLRW MOVWF SSPBUF call snd_debug_esperar banksel SSPBUF MOVFW SSPBUF MOVLW b'0000100' ; 0x10 inverted MOVWF SSPBUF call snd_debug_esperar banksel SSPBUF MOVFW SSPBUF MOVLW 0x00 MOVWF SSPBUF call snd_debug_esperar banksel SSPBUF MOVFW SSPBUF MOVLW b'0111111' ; 0x7E inverted MOVWF SSPBUF call snd_debug_esperar banksel SSPBUF MOVFW SSPBUF MOVLW 0x00 MOVWF SSPBUF call snd_debug_esperar banksel SSPBUF MOVFW SSPBUF CLRW MOVWF SSPBUF call snd_debug_esperar banksel SND_PUERTO_SS BSF SND_PUERTO_SS,SND_PIN_SS return
DAvid
Yes, bit-banged.
The ISD1700 chips are tempermental to say the least. I have it working fine in my project, but there are some undocumented problems with this chip. Overall the documentation is inconsistent/poor and difficult to find current versions. I found out after a year of using this chip that I had the outdated datasheets.
Also, the development systems were redesigned when it moved from Winbond to Nuvoton. And the Winbond hardware does not work with Nuvoton software, so if you were unlucky to buy the early ones, you get to buy it all over again (or you just design your own). I like this chip, but Nuvoton does not help with the problems.
As for SPI, I have worked with the ISD1700 and another SPI device connected to the same PIC micro. Each device uses the complete opposite SPI communications format. The logic levels are inverted and the MSB/LSB is reversed on each device. I don't know which way is "standard" for SPI. So you may want to try changing MSB/LSB data and try inverting various signals (clock, data, chip select).
Otherwise the code examples in previous posts on this thread should be a good head start.
Russ
N0EVC, xWB6ONT, xWN6ONT
"Easy to use" is easy to say.
Hello All,
I've made some progress. At least the MISO pin is "singing" with 1's and 0's. But I can't seem to get the chip to record or play. I'm using the LED off of pin 2 as an indicator. I even put a test probe and monitored the pin 2 just in case the LED was put in backwards.
I also started monitoring pins for more "foolproof" software rather than guessing at delays. One of the things I realized that after sending the record command, 0x51 (bit 4 set for LED) and 0x00 (data byte), the interrupt bit in SR0 never gets set. And according to the datasheet I believe it's suppose to get set after executing that command. I also tried sending the stop command right after the record command, thinking that maybe the interrupt bit is set after the record command is stopped, and this still doesn't result in the interrupt bit being set.
I just want to make sure I'm using the latest datasheet. Is revision 1.1 from May 2007 the latest?
Thanks, Alan
Hey ams,
you stated in a previous post something about using C programming. are you even using Picbasic Pro for your pic project or you trying to do this in C?
what is the size of your ISD device you stated its a 1700 but no size specified. this is important as you need to know the start and end addresses of the messages you are trying to record.
If you haven't seen my post #30 i definitely recommend the Cowlacious Designs ISD board. http://www.cowlacious.com/AudioProd.htm
-RFEFX
There are 10 kinds of people. Those that know binary and those that do not.
On my very first post i linked the Design guide.
the design guide is different from the datasheet as it gives you vital ISP codes and timing information.
Make sure you are referring to the design guide and not the data sheet.
Unless Nuvaton changed this....
but then again, my project is working... (no offense)
if you are using Picbasic you mind posting some of your code so that some of us may analyze it? I'm sure Jerson can dissect it in his sleep (again no offense)
There are 10 kinds of people. Those that know binary and those that do not.
RFEFX,
Yes I'm using C to program. I figured this post was as much about interfacing with the ISD17000 and using that hardware, that it was okay to post my question(s) as long as I leave the actual programming out of it. If it's not, just let me know.
Yes, I've been using your Post 30 as a guide for the SPI interface. Thanks for your work. It's been a great start and will definitely help.
I'm working with a custom PCB I built. I'm still on rev 1, so we'll see how good of a PCB designer I am![]()
I'm also using the 17240 chip. I'm only using the generic record and play commands at this point. Would their be a reason I can't do this?
Alan
Last edited by ams0178; - 17th March 2010 at 08:04. Reason: Didn't answer all previous questions.
Bookmarks