PIC18F25K22 UART ERROR

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

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

I see you have set the chip to run on it's internal oscillator. For this to work you also need to include a C-Code block as your first icon in your chart to set the associated register. If you add in Component Libraries > Runtime > IntOsc Helper this will assist in creating the required code. You can copy & paste the suggested code directly into your C-code block. The WDT was enabled but no "clears" were present so the chip would reset itself every x-seconds. I disabled this for your tests.

I also removed the connection points as they at present are not required, the Loop itself will increment and populate.

Your variables a/k/x are floating point, however you forgot to initialise them as such ( "0.0" )

When sending to Excel, I found you need to terminate with \r\n or else you end up with a very long string.

I modified your chart based on the above (attached).

Hope this helps.

Regards
Attachments
TEST2N-A_Modified.fcfx
(17.23 KiB) Downloaded 460 times

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

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi ,
I made some tests with last FC charts , ESP-ESP_AP_RX and ESP-ESP_AP_TX . I get no data from sender so far.
In sender, as it seems in simulator, there is no sending data to receiver ..I don't change dummy data before get that in receiver and then to PC...receiver send data to Excel with PIC18F25K22 after corrections, so I think the problem is maybe in sender..
Attachments
ESP-ESP_AP_Rx.fcfx
(30.88 KiB) Downloaded 455 times
ESP-ESP_AP_Tx.fcfx
(20.57 KiB) Downloaded 529 times

chipfryer27
Valued Contributor
Posts: 1576
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 561 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

Watchdog Timer is set in both your charts therefore they will be resetting the chips every x-seconds. Disable both in Build>Project Options.

Lets focus on the Rx side first.

Do you have a serial-usb convertor? If so refer to the diagram I sent earlier. Connect the Rx pin of the adapter to the Tx pin of UART2 (the one facing the PC). Set your terminal program for 9600 baud and connect.

Boot/reboot the Rx PIC. Do you see anything appear in your terminal program? You should receive "Test OK". If not double check all connections and settings as there really isn't much to go wrong at this stage.

Regards

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

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
I was checked connections...are ok..with set watchdog timer enabled , after boot/reboot I have test OK after 2min and every 2min...with set watchdog timer disabled, I have no test OK...
regards

chipfryer27
Valued Contributor
Posts: 1576
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 561 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

Good and bad :)

Good it did something expected, bad not exactly what was expected...

Keep WDT disabled. The fact that you are getting the message repeated shows that the WDT is working as it is resetting the PIC every x-seconds, and as you see the message, connections / speeds are fine.

When you boot, pretty much immediately the "Test OK" will be sent out on the UART, so it could be easy to miss. Keep your terminal program connected when you reboot/power cycle chip and you should see the message.

Do you have a display connected?

Regards

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

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
no display connected...I'll try to connect a general 4X20 that I have...but can it works with V+ 3,3V ?..
if connects , how can use that for test?
regards

chipfryer27
Valued Contributor
Posts: 1576
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 561 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

In case you don't have a display I modified the Receiver to send out on the UART. We know you can see info coming out so hopefully this will assist a bit more.

Also, in your Send program I see you have set the server address as 28.0.0.0 this needs to be the same address displayed on the receiver (or sent out on UART to PC in this version).

Hope this helps.

Regards
Attachments
ESP-ESP_AP_Rx_UART-Out.fcfx
(27.87 KiB) Downloaded 458 times

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

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
some corrections in sender hardware and continue tomorrow...many thanks .
regards

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

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
first test with (ESP_ESP_AP_Rx_UART_Out)...with sender connected (ESP-ESP_AP_Tx), I get the following

Start fail UART Test OK
Initialise ESP
ESP OK
Create AP
AP Created
Get ESP Server IP
IP=192.168.4.1
Start Server Start OK Waiting for Data..

it seems that sender don't send data...wrong IP in sender code?

regards
Attachments
ESP-ESP_AP_Tx.fcfx
(20.58 KiB) Downloaded 522 times
ESP-ESP_AP_Rx_UART-Out.fcfx
(29.16 KiB) Downloaded 539 times

chipfryer27
Valued Contributor
Posts: 1576
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 561 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

I have to have a quick smile. Clearly I need to have less beer when I punctuate based on your UART output...:)

I shall tidy that up later.

However the good news is that you are pretty much there.

The UART is showing that your Server IP is 192.168.4.1 and this address must be set in the PIC used to Send the data.

In the Tx unit remember to set your SSID, Password and Server address (in this case 192.168.4.1) and also to disable the WDT.

Boot Rx unit before Tx unit as just now, if the Tx tries to connect before the Rx is ready it will fail. The Rx will take longer to boot. Perhaps wait until the "waiting for data" is sent out on UART before booting Tx.

Whilst the Tx is connecting you will see in the Rx UART connection details, then once established the data will appear.

Regards

Post Reply