Author Topic: [SOLVED] UART console example not working on mcMod120  (Read 45 times)

rudydevolder

  • Newbie
  • *
  • Posts: 26
  • Belgian guy married Phillipina
  • Location: Philippines
    • View Profile
[SOLVED] UART console example not working on mcMod120
« on: July 31, 2017, 02:58:57 am »
The jumpers for pin 0 & 1 are in default position which means connected.
and I tried the UART terminal example after adapting the pins like this:

       Define PinMode Pin1 As DigitalInput
       Define PinMode Pin0 As DigitalOutput

        ser = Uart.Create(9600, Pin.Pin0, Pin.Pin1)

I can compile & run it but nothing seems to happen.  ???
« Last Edit: August 03, 2017, 03:21:16 am by rudydevolder »

Social Buttons


mc-Gyver

  • Global Moderator
  • Newbie
  • *****
  • Posts: 13
    • View Profile
Re: UART console example not working on mcMod120
« Reply #1 on: July 31, 2017, 02:42:46 pm »
Hi rudydevolder,

One thing to take note is that Pin0 and Pin1 are also used for virtual gateway communication whereas wireless mcAir is disabled in replace for direct wire UART communication. This feature is enabled when mcStudio is running and mcMod120 does power on reset while on the dev board with pin0 and pin1 are connected.

There are 2 options you can do. you either have pin0 and pin1 disconnected when the device does power-on reset and reconnect them once you can see beacons from the mcMod120 on mcStudio OR you can use other pins and connect them thru jumper wires to the RXD and TXD pins on USB UART header.

rudydevolder

  • Newbie
  • *
  • Posts: 26
  • Belgian guy married Phillipina
  • Location: Philippines
    • View Profile
Re: UART console example not working on mcMod120
« Reply #2 on: August 03, 2017, 03:19:24 am »
I got it working now, but only after finding that there must be a mistake in either the Dev Board or the documentation:
In the docs is stated:
16.39. Uart Class Inherits Object:    Public Sub Create(baudRate As Integer, tx As Pin, rx As Pin)
But I found that Rx comes first and then Tx.
So this works fine: ser = Uart.Create(9600, Pin.Pin1, Pin.Pin0) // Pin 1 to Rxd and pin 0 to TxD; Dev-Board default jumper config  ;D
Also something not working like it should:
ser.Write("Hello") ser.Write(0x0c) ser.Write(0x0a)    ??? this seems to give a newline but no line feed, so my line is overwritten in Putty and disappears, I found out after putting in a loop for 50 times.
when I do the following:
ser.Write("Hello") ser.Write(13) ser.Write(10)   :)    it works, how comes?