Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:05 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Framing Error

Author Message
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 124
Posted: 04:51pm 15 Jul 2024
Copy link to clipboard 
Print this post

Hi Guys,

I got an error message at this line of code in a short program for Picomite.

RUN
[18] Device SerialRx 34, 4800, Msg$, 200, status%
Error : Framing error
>

This is the command from the handbook:
DEVICE SERIALRX pinno, baudrate, istring$, timeout_in_ms, status% [,nbr] [,terminators$]

The above line is inside a Do Loop. Am using Version 5.08.00. I had it working OK with a previous version (called BITBANG SerialRx back then.)

What is a Framing Error? How can I track it down? Not mentioned in the manual.

Regards,
Louis

-
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 11:14pm 15 Jul 2024
Copy link to clipboard 
Print this post

Just a guess. Perhaps it is to do with starting Rx in the middle of a Tx byte. Maybe you need to start Rx just before Tx begins, and ensure they stay synchronised.
> do:Device SerialRx gp1, 9600, Msg$, 1000, status% : ? Msg$ :? :? status%, len(Msg$) :pause 990 :? :loop
$GPRMC,230344.00,A,3730.57126,S,14521.66403,E,0.062,,150724,,,A*6A
$GPVTG,,T,,M,0.062,N,0.115,K,A*22
$GPGGA,230344.00,3730.57126,S,14521.66403,E,1,08,1.00,584.2,M,-0.3,M,,*5B
$GPGSA,A,3,04,09,07,27,16,30,03,08,,,,,1.78,1.00,1.47*0F
$GPGSV,4,1,14,03,17

2       255

ºbÂb²b¢bªb?bÊb²b¢b²b
                   bºbª²bªÂbªRº
                               AMYbb
                                    ¢bÂb
                                        ²bªÂb
                                             bÊbº²b
                                                   ?b¢²b

                                                        bªb¢Âbb
                                                               ¢b
                                                                 bb
                                                                   ºRºAMYbb
                                                                           ¢b
                                                                             ²b¢b
                                                                                 b²bb
                                                                                     bbºb²bb
                                                                                            ¢bbºb
                                                                                                 ºb?b²Rº²AMYb¢b
                                                                                                               ¢bb²bºÂbbªb¢b
                                                                                                                            bRººA11ºrªº
                                                                                                                                       b¢ª
                                                                                                                                          r²²Ê
                                                                                                                                              b¢ªrbþ$GPRMC,

2       255

Error : Framing error
> option list
PicoMiteVGA MMBasic Version 5.09.00RC5
 
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 124
Posted: 01:06am 16 Jul 2024
Copy link to clipboard 
Print this post

Thanks Phil.

Lucky you! At least you are seeing data of some kind. I'm not.

Forgot to mention: Am getting the framing error without having any data stream coming in. The error appears immediately on encountering the above line of code in the first round of the DO loop. Doesn't even get a chance to print anything.

Do
 Bitbang SerialRx 34, 4800, Msg$, 1500, status%  
 Print Msg$
 Print status%

Might try going back to a previous firmware version.

-
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 01:56am 16 Jul 2024
Copy link to clipboard 
Print this post

  Quote  The error appears immediately on encountering the above line of code in the first round of the DO loop.
I get that if Tx has started before starting Rx.
Perhaps there is noise on your Rx pin?
It should be idle high, any lows will look like the start of a byte.

To test disconnect Tx and tie Rx pin to 3.3V.  Then increase the time-out to 1000 and
put Msg$ = "Looping" before the Device command and see if you still get the Framing Error.
If that works try a pullup on the Rx pin - 1.8 to 3.3kΩ perhaps.

In the case of the GPS receiver keeping it synchronised by setting a terminating character allows it to run, provided I start Rx between transmissions.
do
 Device SerialRx gp1,9600, Msg$,500,status%,127,Chr$(13)
 ? Msg$:?
 ? status%,len(Msg$)
 pause 900
 ?
loop
$GPRMC,014620.00,A,3730.56888,S,14521.66039,E,0.064,,160724,,,A*6D

3       67

$GPRMC,014621.00,A,3730.56894,S,14521.66039,E,0.056,,160724,,,A*60

3       67

$GPRMC,014622.00,A,3730.56898,S,14521.66044,E,0.030,,160724,,,A*65

3       67

$GPRMC,014623.00,A,3730.56906,S,14521.66043,E,0.081,,160724,,,A*6F

3       67

'etc, ad infinitum

Edited 2024-07-16 14:53 by phil99
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4223
Posted: 07:43am 16 Jul 2024
Copy link to clipboard 
Print this post

Hi,

Assuming 3.3V logic levels on the UART pins of your PicoMite.

Please check if there is a pullup on the RX line. The RX line is connected to the UART, and the UART checks for a high-to-low transition on the RX line, to check for a start bit. But when the RX line is constantly low, this is treated as a "BREAK".

This results in an error, since it violates the RS232 "frame" time (start bit/x bits/y stop bits). A constant high level on the RX line keeps the UART waiting for new data, which is normal operation. But constant low causes a framing error.

Regards,

Volhout
PicomiteVGA PETSCII ROBOTS
 
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 124
Posted: 02:56pm 17 Jul 2024
Copy link to clipboard 
Print this post

Thanks Volhout!

IT NOW WORKS and receives data correctly.
Your pullup resistor suggestion for the Rx line did the trick.
I used 8.1k.

However, I now see my next challenge.

Will post tomorrow if still unresolved.

-
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024