PIC18F25K22 UART ERROR

For general Flowcode discussion that does not belong in the other sections.
Post Reply
chipfryer27
Valued Contributor
Posts: 1367
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 330 times
Been thanked: 475 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

I've updated the Tx / Rx to be a bit tidier and use defaults so that you should not need to set anything to receive dummy CSV data (12.34,56.78 ).

My Rx ESP was previously set as 28.0.0.0 but I changed that to 192.168.4.1 as per most documentation.

When the Rx boots you should see the following in "Terminal" or Excel DataStreamer.

ESP_Rx_Startup.png
ESP_Rx_Startup.png (18.82 KiB) Viewed 2698 times

Once the Tx boots you will see a few lines regarding connection, before your Data starts to appear.


ESP-ESP_AP_Rx_UART-Out_v2.fcfx
(31.59 KiB) Downloaded 323 times
ESP-ESP_AP_Tx_v2.fcfx
(20.39 KiB) Downloaded 280 times
The ESP's will most likely retain AP data and autoconnect and I looked at checking for this and also to check if it was connected to the Rx before sending data. However to do this I need to use the UART to send AT commands rather than the component. I will probably look at that later.

Regards

SILVESTROS
Posts: 118
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 31 times
Been thanked: 2 times

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
so far after some tests with final charts...
with WDT disabled, no data either in terminal program or Excel.

with WDT enabled
At terminal program ,after 2 min from reboot I get "TEST OK" ...after 1 min data 12.34,56.78 for 1 min...then stop data for 1 min , then the same from TEST OK...
At Excel , after 2 min from reboot only "TEST OK"...no data..

Is it possible to reduce time from reboot to get data?

regards

PS..above before I see your last message ...only I note that you use PIC16F1939 and PIC18F46K22 for TX and RX...
is it possible to send me last chart (V2) with PIC18K46K22 and PIC18K25K22 for TX, RX respectively , because config is different ? thanks
Attachments
ESP-ESP_AP_Rx-MF.fcfx
(27.56 KiB) Downloaded 277 times
ESP-ESP_AP_Tx.fcfx
(20.6 KiB) Downloaded 165 times

SILVESTROS
Posts: 118
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 31 times
Been thanked: 2 times

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

HI,
I get no data with set PIC18F46K22/ PIC18F25K22 , with WDT disable...when WDT enable, I get data in terminal with delay ,but not in Excel...I don't know if this is about config...with PIC16F1939 in sender , I must change hardware , If I can find that PIC in similar case (QFP)...also PIC16F1939 don't have 2 I2C inputs that I need for sensors..
regards
Last edited by SILVESTROS on Tue Mar 21, 2023 5:43 pm, edited 1 time in total.

chipfryer27
Valued Contributor
Posts: 1367
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 330 times
Been thanked: 475 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

WDT will cause the chips to reset after x-seconds unless you specifically set clears. If both chips have it enabled then they will be rebooting most likely at different times and you will never successfully obtain a stable connection.

As you do see Test OK and data, then everything appears to be fine other than them rebooting. Remember to boot Rx first then Tx a little later (perhaps once you see waiting for data).

I modified to use your chips, but I have no way to test. Hopefully I didn't mess anything up.


ESP-ESP_AP_Rx_UART-Out_v2_18F25K22.fcfx
(29.82 KiB) Downloaded 255 times
ESP-ESP_AP_Tx_v2_18F46K22.fcfx
(20.3 KiB) Downloaded 249 times

Regards

SILVESTROS
Posts: 118
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 31 times
Been thanked: 2 times

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
never mind about test, I'll do it myself...thanks anyway...
with last charts I get no data neither at terminal , nor at Excel...
regards

chipfryer27
Valued Contributor
Posts: 1367
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 330 times
Been thanked: 475 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

I'm confused. You state in an earlier post that with WDT enabled you got data.

The reason it was repeating itself was due to having WDT enabled thereby constantly rebooting. You cannot enable WDT unless you specifically set clears within the program, nor can you even attempt to establish what is going wrong.

You say you got info/data on your terminal program, but not in Excel which sounds like a datastreamer setup issue. I provided details on setting up DS in another post a few weeks back.

When you test can you do the following for the Rx (forget about Tx, don't even power it).

Set up a Terminal program to monitor PIC UART-2 Tx pin (PIC Tx to USB-serial adapter Rx). Remember to check Chip Tx/Rx pins match your setup as in the last iteration UART-2 pins moved from Port D to B. Check baud is 9600.

Boot / cycle power on Rx circuit.

You should see something similar to the screenshot I provided in an earlier post. If not can you provide a screenshot of what you do see?

If you get to "Waiting for Data" then boot the Tx (again check pinouts etc match).

On the Rx you should see a few lines relating to connection, then data should start. If not can you send a screenshot of what you do see then we can check Tx.

Regards

SILVESTROS
Posts: 118
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 31 times
Been thanked: 2 times

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

HI,
with Terminal, I get diagnostics when I start RX (serialusb1)...DATA when start TX (serialusb2)...everything is ok.
in DataStreamer with same procedure as above I have no data (datastreamer1)...
I use many times DS with sending data in CSV format,and I get data normally, so I can't find an error in setup..note that data in my examples is sending in form sendFloat...what about sendChar that we use in RX ? I'll check it..
the procedure for getting data with DS is the same as for terminal ?
It seems that there is no CSV sending data format , or maybe DS don't accept sendChar...
generally we are ok..some details is missing to get data in DS...

regards
Attachments
datastreamer1.png
datastreamer1.png (212.74 KiB) Viewed 2667 times
serialusb2.png
serialusb2.png (245.94 KiB) Viewed 2667 times
serialusb1.png
serialusb1.png (264.68 KiB) Viewed 2667 times

chipfryer27
Valued Contributor
Posts: 1367
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 330 times
Been thanked: 475 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

Happy to hear you are getting data coming through :)

When I test, I had my Serial-USB connector connected to my PC. My Terminal saw this as Com-4 and I received much as you do above. After a few seconds or so my test data comes through as CSV.

When I need to connect to Excel, I have to first disconnect my Terminal program or nothing comes through to Excel. It may be best if you wait until you see data in your Terminal program then close it completely. Once closed then open up Excel DS and connect (or even don't bother with Terminal at all, just open up DS and connect to your Serial-USB adapter).

Can you try that and let me know how you get on?

My tests of a few weeks ago showed that DS accepted anything in ascii format (string). My Tx chart is sending dummy values as a string every 5 seconds ("12.34,56.78"). To send real world sensor values that data would first need conversion to be a string, as per a previous post earlier in the thread.

However before looking at that we need Excel to receive the dummy data, so let me know how it goes once you try with your terminal program closed.

Regards

SILVESTROS
Posts: 118
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 31 times
Been thanked: 2 times

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
no data when connect to excel..RXD red led on serial/usb flashes when it connect to terminal...when disconnect from terminal and connect to excel that led stop to flash...maybe we must check charts in sending section?
regards

chipfryer27
Valued Contributor
Posts: 1367
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 330 times
Been thanked: 475 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

As you are getting CSV data when you use Terminal, the Tx is sending out fine. The issue appears to be with Excel and DS.

In Excel, clicking the Data Streamer button on the ribbon brings up the DS Header with a few numbered options. 1-Data Sources, 2=Data Steaming and 3=Data Recording.

Clicking Connect a Device brings up your available options. I selected my Serial-USB device which then brought up a window informing of my choice and to click Start Data to begin recording.

Clicking Start Data changes the sheet and the data starts to populate.

Have you checked baud etc in DS?

Regards

Post Reply