Page 1 of 1

SPI Modes?

Posted: Wed Oct 24, 2007 8:46 pm
by janleroux
Hi,

I have build a test circuit on breadboard using a 18F452 and MAX3100 (SPI UART).

I have initialised the SPI and MAX3100 according to the specification. On the sending side, everything works fine, when I send ASCII characters via the SPI bus to the MAX3100 then they're all send out via the RS232 port (checked with Hyperterminal). On the receiving side things does not want to work so well.

When the MAX3100 receives the RS232 data, it generates an Interrupt (RB1/INT1). The interrupt works, and executes when I send a character from Hyperterminal to the MAX3100. The macro that is executed when RB1/INT1 triggers, should read the data from the SPI and then echo it back to the MAX3100 again, but I only receive "00001011" back no matter what I send.

I have written this test routine in MPLAB using C18 and it works, so I know that my HW is correct. I just can not get it to work writing the code in Flowcode.

I have compared the settings in both programs and the only part that I am not sure about at this stage is the bus mode. In MPLAB with C18, it works when the bus mode is in MODE 00.

How do I determine what the bus mode is in Flowcode?

And, I will really appreciate some pointers, if anyone have managed to get a MAX3100 working in both sending and receiving.

Thanks for your comments/help!

Regards
Jan

Posted: Thu Oct 25, 2007 9:33 am
by Benj
Hello

By bus mode 0 I am assuming you mean Fosc/4 which is set in the SSPCON1 register. This is controlled via the SPI component property page.

If this does not help then would it be possible to send me the C functions for your C18 program and the FCF and C files from your flowcode program.

Posted: Thu Oct 25, 2007 10:04 am
by janleroux
No, in C18 I initialised the SPI in this way:

Code: Select all

Open(SPI_FOSC_64,MODE_00,SMPEND);
How do I forward the files to you (to which e-mail address)?

Thanks for your help with this!

Regards
Jan

Posted: Thu Oct 25, 2007 11:52 am
by Benj
You can use the support@matrixmultimedia.co.uk address.

Please can you send the entire set of C18 files and the entire set of Flowcode files.

Also have you tried setting the SPI properties to Fosc/64 as it seems like that is what is happening with the MPLAB program.

Posted: Mon Oct 29, 2007 2:03 pm
by janleroux
Hi Ben,

I would just like to confirm that you have received the files that I have send to you via e-mail?

Regards
Jan

Posted: Mon Oct 29, 2007 3:54 pm
by Benj
Hello Jan

Yes I have recieved the files. I have had a couple of looks through and so far I have not found anything obvious. I will continue to try to find a solution when I get time. I should be able to give it some attention this afternoon. Sorry for the delay.

Posted: Thu Nov 29, 2007 11:34 am
by janleroux
Hi Ben,

I just want to follow up on this SPI issue - could you find anything as to why these functions in Flowcode does not want to work.

Due to time constraints I had to finish my project directly in C18 and MPLAB, which is a pitty as I would really have liked to do this "bit more demanding" project in Flowcode.

But, there will be more projects, and I would still like to know if there is a bug in Flowcode, or whether there is a different way to get this SPI communication to work?

Thanks for your help and feedback!

Best Regards
Jan