This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hello,
I am using the tms570 launchpad to communicate using the SCI interface. I am trying to send from sci1 to sci3 on the same board.(sci1 for sending/sci3 for receiving).
I've enabled interrupts for rx on sci3 in the SCI global tab, also enabled in the VIM Channel sci3High/Low interrupts and pinmux for sci3. In the header file _enable_interrupt_() I see this as being used to enable interrupts for non-OS use( but I also tried with _enable_IRQ_interrupt_() ). On the board I connect the tx of sci1 to the rx of sci3.
When I've debugged, I've noticed that the sciNotification() is never triggered.
I' ll also attach my main source file.
This is the setup:
pin J5.44(UA1TX) connected to pin J1.3(UA3RX)
I already did what you said, it won't work. I tried it again even now. I managed to transmit data with sendbyte and receivebyte without using interrupts, but I want to implement interrupts.
Unfortunately I don't have an oscilloscope, but I checked the sci->td register which is the transmit buffer and the data is shifted correctly through it.
What's weird is that I did the same thing over an older project and it enabled the interrupts, but even then, the data wasn't transmitted as expected.
Regards,
Ciprian.
I did that, but I still don't receive data. Anyway, something else that I don't understand is the following:
I disabled all interrupts and just send byte by byte because I saw in other instances that somehow I only receive the last byte from sci->td even if I use sciSend/sciReceive not sciSendByte/sciReceiveByte, I don't know why it behaves that way. So, now I use the sciSendByte/sciReceiveByte without interrupts and I can see data when I debug, only if I set the breakpoints as shown below:
But if I set them in other manner, as shown below:
It will run in a infinite loop in the sciReceiveByte, waiting for incoming data. I also try to put delay between sending and receiving. Now I am confused, because I don't know if I send/receive any data at all.
Something is ok, but also wrong in the same time.
Please can you explain this issue? Also receiving in an interrupt won't work, or the same thing happens and I can't see data that is received at that specific time.
Regards,
Ciprian.
Hello Ciprian,
About using SCI receiving in interrupt mode... Please put a breakpoint at interrupt handler (sciHighLevelInterrupt). sciNotification is called inside interrupt handler. If you are entering to interrupt handler, may be sciNotification is not called because if (g_sciTransfer_t[0U].rx_length > 0U) is always false. If this is the case, try attached file. Instead of calling sciReceive prior to send data, you can initialize values manualy.
Best regards,
Miro
Hi Ciprian,
Sorry, you can delete this raw or you can change it to sciREG1...
Best regards,
Miro
Hello Miro,
So In order to figure this one out I will attach my files, halcogen + HL_sys_main, the following example is working. The main difference was that FLR register which is set up manually in the main. Also, the sciNotification it doesn't work at all, if I use the receive in the sciNotification I only receive the last byte. I don't know why. And if use both, it won't work properly, it will receive the data and afterwards it will replace the first byte in the rx with the last byte from tx, which is basically receiving only the last byte, which I already explained(the receive function should be called only once anyway). I hope that you agree with me on this one. The only thing which I don't understand is that sciNotification function which doesn't work, otherwise all good.
Regards,
Ciprian.
Hello Ciprian,
The reason I put sciReceive in main.c is to initialize length... Interrupt handler starts with checking length... sciReceive should be called before sending any data and after first 5 bytes (in your code) were sended to prepare uart for next bytes (length could be different).
Best regards,
Miro