2015-12-10 05:11 AM
Hi
i have a strange problem. i have configured the spi6 on stm32f429 board and i have included the configuration below. After i download to flash, its starts blinking the lights.i am not understanding why the led blinks?. i have configured as a AF for SPI.2015-12-10 05:32 AM
i am noticing that led turn on when i keeping the polarity = SPI_CPOL_Low ; phase = SPI_CPHA_1Edge;
when i am keeping polarity and phase = 0 then led is turned off.Could anyone explains.2015-12-10 05:36 AM
What lights? What LEDs? How are they connected? Under which condition do they light up normally? Do you have any other code there? Any interrupts? Did you try to wiggle the same pins in a trivial program just by setting them to GPIO output and toggling in a loop? Did you monitor the pins and power supply by an oscilloscope?
JW2015-12-10 05:58 AM
i am using the stm32f429 discovery board..
sorry, i meant light as led.. led green and led red.no interrupts . i have the usart5 and it works properly and no other code.it works fine, when the polarity = SPI_CPOL_Low... and phase are SPI_CPHA_1Edge. when i change the phase to SPI_CPHA_2Edge then the red led turn on. when i chnage the polarity = SPI_CPOL_High then green led turn on .i really got confused ...please tell me why and how to solve2015-12-10 06:18 AM
> * SPI6_MOSI --- PG14
> * SPI6_SCK --- PG13 These are exactly the pins where the LEDs are connected to. Why is it surprising that they light up when you wiggle these pins? Of course their light depends on what data are transmitted, what is the idle state of clock and how often is the clock idle. Cm'on, did you have at least a glimpse into the DISCO board's schematic and UM1670, or are you just blindly clicking around and churning out code? JW2015-12-10 07:07 AM
waclawek.jan, i know that pg13 and 14 are connected to the led.
as i explained clearly before, both the led is not turning on until i change the polarity to high and phase to spi_CHPA_2nd edge. my question is why it's behave in that way ?note that, the led is turned on without sending or receiving .2015-12-10 10:16 AM
CPOL determines the clock's idle state, that straighforwardly implies that you can set the SCK pin to any level you want while not transmitting.
CPHA determines (among other things) whether MOSI will output the current transmit buffer's MSB (or LSB, depending on shift direction setting), or the previously transmitted frame's LSB (or MSB), which is remembered in an internal latch. After reset, these may be in a random state, and that may be of opposite value, that's how CPHA influences MOSI while not transmitting. Changing CPHA and CPOL while SPI is enabled, even if not transmitting, may have other side effects and I recommend against. Nevertheless, if you are annoyed by the LEDs lighting up or not, why don't you simply remove them from the board? JW2015-12-11 12:36 AM
waclawek.jan, thanks for your answer. its just curiosity to know why its happened.