Welcome! Log In Create A New Profile

Advanced

Using UART1 in BV509

Posted by enrher 
Using UART1 in BV509
November 21, 2015 08:07AM
Hi,

I am traying to use UART1 in BV509 for connecting a GPS module in the ESP8266 connector. I've attached the TX pin to the RX of the GPS and the RX to TX, but I am not able to get the GPS messages. I know that the GPS is working, as the led showing that it is attached is flashing. Rookie 3 is installed.The code I am using is:

function gps()

dim power, nchar, nmea$, car

// rx,tx
pps_in(*U1RX(),*RPF2()) // RX pin set to U1RX
pps_out(*RPF3(),*U1TXs()) // TX pin set to U1TX (NOTE the U1TXs)

io_pinRole(*RF3(),IN,WOFF) // set up RF3 (UART RX) for input
io_pinRole(*RF2(),OUT,WOFF) // set up RF2 (UART TX) for output

io_pinRole(*RE6(),OUT,WOFF) // set up RE6 (Power on) for output
io_pinSet(*RE6(),1) // the ESP 8266 power is on

power = io_pinGet(*RE6()) // realmente tras el reset RE6 está ON


if power = 1
print "GPS encendido"
else
print "GPS apagado"
endif

comclose(1) // cierra UART 1, para limpiar.

comopen(1,9600,128) // UART,Baud,Buffer_size
// COM 1, 9600 by default in GPS

while comkey?(2) = 0
nchar =comkey?(1)
if nchar >0
print "chars: ", nchar
print "/n"
nchar=comread(1,nmea$,80,0)
print nmea$
print "/n"
nchar =0
endif
wend

comclose(1)

endf


Could you help me to see why it is not working?

Br

eHc
Re: Using UART1 in BV509
November 21, 2015 10:02AM
The BV509 is already setup to use UART1 for the ESP8266 on specific pins for that socket. If you go to the link:

[www.bypic.byvac.com]

and open the Rookie_2.zip file in there there is a file called ESP8266_509.bas. This has the code for connecting to UART1 using the ESP8266 connector. See the function wf_start(). In fact there are some functions in there that may be very useful for GPS

By the way the pins are TX RF3, RX RF2

Jim
Re: Using UART1 in BV509
November 22, 2015 10:55AM
After implementing the code you pointed out, I realized that I had a wiring mistake, and once corrected it is working now.

Thanks for your help.

eHc
Sorry, you do not have permission to post/reply in this forum.