View previous topic :: View next topic |
Author |
Message |
PICoHolic
Joined: 04 Jan 2005 Posts: 224
|
PIC18F87J50 SPI_2 stalls! |
Posted: Mon Feb 04, 2008 5:44 am |
|
|
Hello to all,
when using SPI 2 (hardware module):
Code: |
set_tris_d(0x2F);
setup_spi2(SPI_MASTER|SPI_XMIT_L_TO_H|SPI_L_TO_H|SPI_CLK_DIV_4);
|
It stalls when trying to write:
Any idea why? Is it a compiler (4.066) bug?
I didnt find any SPI errata related to the above mentioned microcontroller!
Thank you |
|
|
Ttelmah Guest
|
|
Posted: Mon Feb 04, 2008 7:21 am |
|
|
You are setting up SPI2. Hence you _must_ use spi_write2.
As it stands, spi_write, will try to talk to the non-configured first SPI. It will be turned off by default, so will never return 'finished' for a write transfer. Hence 'hang'...
Best Wishes |
|
|
PICoHolic
Joined: 04 Jan 2005 Posts: 224
|
|
Posted: Mon Feb 04, 2008 8:01 am |
|
|
My mistake
Thanks Ttelmah,
I appreciate it |
|
|
Ttelmah Guest
|
|
Posted: Mon Feb 04, 2008 11:17 am |
|
|
Anyone here, who claims _not_ to have made this sort of mistake, is lying.
Been there, got the 'T' shirt...
Best Wishes |
|
|
|