If you go to the start page, "File", "Example Project", you can pick
a working SPIM project to try out. And modify as you wish.
Try using the IMO and PLL to generate the 24M required, see if this helps.
you can also try to write the ouput in a endless loop as well. this would make it easier to check.
I mean continously outputing with the SPI inside a loop, of couse, all some delay inside some can capture the pulses easier.
first thanks to everybody for your replies. I think I have got a general problem because the UART doesnt't work correctly, too.
I implemented a UART and send out data with UART_1_PutArray(). But the device sending out the data correctly. See the picture 004. The UART should put more databits out. So I don`t know where´s the mistake is. A few days ago it was very easy to implemented a UART/SPI.
In the attach is the scope picture 005. And the programm to testing UART. This project was the SPI example projekt. The SPI didn't work today, too. I tried out your answers: For example I changed the clock to PLL/Internal Clock. But I get the same results as yesterday.
spiuartproblem.zip 2.1 MB
* Picture 005
*And I test the program with different hardware. For example CY(CKIT-050 PSoC 5LP Development Board.
What makes you think that none of the components uses interrupts?
Generally speaking: I suggest you to enable global interrupts as a standard and only disable them when explicitely wanted.
That is correct, in my posted project I don't use CyGlobalInterruptEnable.
But normally I had use this function. So I don´t think that is the problem.
A few minutes ago I add the function to a simple UART projekt. transmit with: UART_1_PutChar(0xAA); (And UART ony send out 3 bits. (002.jpf). And I got the same bad result as before.
Thanks everbody for your help!
0021.jpg 83.9 K
I modified your project as follows -
1) uart array declared as "const", PutArray wants array to be that
2) uart pin to P4_0, initial output state to 0
3) Enabled global interrupts
4) Eliminated 2'ond for(;;) loop
5) Eliminated your startup delay
Works fine on my -050 board.
okay thanks everybody für your help. I don't know where the problem is. At the moment I try out the UART again and everything works fine. But I have got another Hardware:
- Cy8CKIT-042 PSoC 4 Pioneer Kit
- Annother Computer
See Attach there is my program I had wrote a few minutes ago. UART work. I try this programm tommorow with the previous hardware
I want be snooty but:
At the moment I do a internship...
I work the last weeks with UART every day, from monday to friday and minimum six hours. I wrote a program to listen a Bus and send it out to CAN. I wrote a program to send out UART messages include change the clock of UART. I controlled an ADC with SPI. I controlled a DAC with SPI. Everything works.
But from one moment to the other: I couldn't send out UART messages. I couldn't send out SPI messages. And I used the same programs as before.
(Receive UART Messages works :-))
So, yes I'm not a expert but I think that the problem is not a easy.
- Maybe something with the clock.
I know that I did mistakes in my example projects. But I have time at work so normally I find issus like:
- Forget CyGlobalInterruptEnable.
- Forget to start the Component.
So, I try it out tomorrow again and I will post my results.
Thanks Dana for your time to modified my program.
Design04.cyprj.Archive01.zip 705.3 K
you mentioned in you previous post
"A few minutes ago I add the function to a simple UART projekt. transmit with: UART_1_PutChar(0xAA); (And UART ony send out 3 bits. (002.jpf). And I got the same bad result as before."
the waveforrm is correct. If you draw the waveform on a piece of paper, you should be able confirm that. Or if you change the UART to have the tx_clk/rx_clk output and sent it out to a output pin on the psoc. you should be able to see the uart clock together with the serial data. remember that LSB frist. There are 4 ONE in the packet, the last ONE(MSB) is joined with the stop bit. so you should only see 3 pulse.
I tried this out on PSOC 4, some changes -
1) Variables that either were single letters or looked like potential reserved
words I changed their name.
2) The Rx flag was declared volatile
3) The Tx data sent restricted to ascii chars
I got it to work, by monitoring my var charrecv, except I cannot see Tx data on pin, really strange.
Design04-000.cywrk.Archive01.zip 712.8 K
Hello everybody again,
I think my mistake was that I'm to dummy to control a scope. And maybe I´m to dummy to write a correct UART program, too.
Today I try my last posted project (or look at danaaknight post before this post) with my own Cypress 5LP board. Everythink looks good include the scope pictures. So I create a simular project with SPI. And everythink look include scope picture.
See picture 007.png with yellow = ss (chip select), green = clock, blue = MOSI.
In this picture I sent out 0x01.
@HL thanks for your answer maybe I lose the track of at trying out the UART yesterday. But I got some scope pictures who look wrong, too. But it could be a scope error (I maybe controlled scope false). In my newest project I read my send out data back with an SPI Slave or an UART RX compment. So I could check my sending out data with scope and the read back compoment.
@Dana thank you very much. Maybe it is better to work with two connected input and output ports. And split the direct intern connection between UART TX and UART RX.
Thanks that you modified my project. But I have one question:
Why have you changed the flag variable to volatile. What is the advantage? This question I had asked me weeks ago, too. Without an result.
Thank you everybody again!
Attach file: Working SPI project and the scope result of one cicle 007.png
Didn't work for me as well. I deleted the pin and inserted a new one, now working.