We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I've configured SPI bus on P0.2 (SCLK), P0.3(MISO), P0.4 (MOSI) and P0.5 (NSS) but on these ports: no signal. Normaly, I should have SPI clock at least but I have nothing.
I've configured :
1) Pins:
sbit SPI_SCLK=P0^2; // SPI clock on P0.2 sbit SPI_MISO=P0^3; // Master In/Slave Out on P0.3 sbit SPI_MOSI=P0^4; // Master Out/Slave In on P0.4 sbit SPI_NSS=P0^5; // Slave Select on P0.5
2) Ports:
void port_init (void) { char sfrpage_save = SFRPAGE; // Save current page of SFR SFRPAGE = CONFIG_PAGE; // Load config_page WDTCN = 0xde; WDTCN = 0xad; // Disable watchdog timer XBR0 = 0x02; // Enable SPI bus XBR1 = 0x00; // Enable /INT0 and /INT1 XBR2 = 0x40; // Enable Crossbar and weak pull-up P0MDOUT |= 0x3C; // P0.5, P0.4, P0.3 and P0.2 are outputs (for SPI datas) P0 = 0x3C; SFRPAGE = sfrpage_save; // Restore SFR page }
3) SPI bus:
void config_SPI (void) { char sfrpage_save = SFRPAGE; // Save current SFR page SFRPAGE = SPI0_PAGE; // Load SPI page SPI0CFG |= 0x40; // Master Mode Enable SPI0CN |= 0x8D; // Slave select and enable SPI SPI0CKR = 0x01; // SYSCLK/2 SFRPAGE = sfrpage_save; // Restore SFR page }
I have tried many times to resolve the problem but without satisfaction for the moment.
If you can help me, make it please. Thanks.
Manu
I've tested the port 0 pins, I've made a program : TEST = P0.2; and in this program I made : while(1){TEST = ~TEST}; Does that mean that this port 0 is not damaged?
The worst affliction any uC programmer can have is interruptifobia.
Even worse than largememorymodeleuforia?
Or dynamicallocatiophilia...?
sticktolanguagephilia
"It must ALL be in C" or "It must ALL be in assembler"
Erik