Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - rudydevolder

Pages: [1] 2
I did this at first, you can still see the original definition but I commented because it didn't work. If I put the whole routine in the main class it works. When I move it to the subclass it doesn't work any more, I wanted to make the source cleaner and making some kind of subclass so I can use this more,  so I thought to trick it by putting a event call in the main program and redirect it to the subclass, but even that doesn't do the job.

This is my sub-class:
Code: [Select]
Class UART_Debug
    Shared ser As Uart
    Shared Buffer As ListOfByte
    Public Sub New()
        ser = Uart.Create(9600, Pin.Pin1, Pin.Pin0) // Pin 1 to Rxd and pin 0 to TxD; Dev-Board default jumper config
        ser.Write("DEBUG-TERMINAL started") ser.Write(13) ser.Write(10)
        Buffer = New ListOfByte
    End Sub
    //Shared Event Uart0Receive() Doesn't work in a class so I try to call this in the main-program but it doesn't work either.
    Public Sub UartReceive()
        Dim chr As Integer = ser.Read
        While chr >= 0
            If chr = 13 Then ' CR echo as CR/LF
            End If
            chr = ser.Read()
        End While
    End Sub
    Public Sub print(S As String)
    End Sub
    Public Sub println(S As String)
        ser.Write(13) ser.Write(10)
    End Sub
    Private Sub ParseBuffer()
        Dim S As String
        S = Buffer.ToString
        If S = "help" Then
            ser.Write("Wait I'm going to help you\n\r")
        End If
    End Sub
End Class

And this is my main-program:
Code: [Select]
Class UART_Terminal_v2
    Shared Terminal As UART_Debug
    Shared Event Boot()
        //Data = New ListOfObject()
        Terminal = New UART_Debug
    End Event
    Shared Event Uart0Receive()
    End Event
    Shared Event Every15Seconds() RaiseEvent Every 15000 milliSeconds
        Terminal.println("Every 15 seconds")
    End Event
End Class

The message is printed every 15 seconds. But the Uart0Receive() Event isn't doing anything.  ???

mc-Module / Re: Unable to connect to module
« on: November 06, 2017, 04:30:13 am »
I would update the firmware if the modules are new, maybe the firmware is an old version and incompatible with the gateway.

mc-Module / Re: Unable to connect to module
« on: October 30, 2017, 12:47:06 am »
I have the same problem every time I upload a certain script which seems to hang. When I connect through the McOtaUpdater tool and I erase the script, I can connect again and upload a script that works until I upload a script that hangs I need to erase the script again.
PS. Don't forget to unpower before and after the update.
Hope this helps.  ;)

After just adding a file to my project, and only calling the constructor my MC-120 module hangs, I can't connect any more and I must first connect via MC-OTA-updater to erase the script.

So the only instructions executed in my Class are:

Class WaterTank
    Shared Address As Byte
    Shared Sensor As I2c

    Public Sub New(_address As Byte)
        Address = _address
        Sensor = I2c.Create(400000, Pin.SCL, Pin.SDA, Address)
    End Sub
End Class

And in my main program:

    Shared UartTerm As UART_Debug
    Shared WaterTank1 As WaterTank
    Shared Event Boot()
        UartTerm = New UART_Debug()
        WaterTank1 = New WaterTank(0x10)
    End Event

I'm thinking maybe a memory leak in I2C  ???

mc-Development Kit / Update: I2C problem SOLVED; UNBELIEVABLE
« on: October 03, 2017, 03:25:27 am »
Everything seems to work.
The cause was just cables I crimped myself where 3 out of 3 badly connected on 1 side. I never had problems with my crimping tool, so I really trusted the cables. The fact that I had some signal although with lots of noise made me think it was only pull-ups missing. After studying the scheme and measuring the pins I found out the connection was direct, so it had to be the cable.
The only thing I can think about why I measured a signal is because high frequencies travel through air. I saw the pulses and the I2C Nack reply, therefore I was completely stunned to find out it was just the cable.
I had the cable crimped at a bad night being little sick. So there was to much of the insulator crimped and it didn't touched the wire.
Glad I finally found it. ;D ;D ;D
Lessons learned:
1. I will never trust my cables again and always test them first.
2. Signals travel through air, this can be very misleading. If I only had a good grounding connection I would see it immediately but none of 3 cables had really contact, so Murphy in his fullest glory.


I have succesfully made a connection with a PSoc 4200 as a I2C slave with a McMod110 even at 400kHz ;D
But now I want to use the McDevelopment board it doesn't work any more.
I can see there are 2 LED's placed on that bus. So I presume the signal is BUFFERED and no pull-up resistors are used.
When I use my Digital scope to analyze what's on the I2C bus, I got a NACK. :(
But when I look on my analog scope I only see a noisy signals of around 0,5 Volts on SCL and around 200 milliVolts for SDA, clearly no pull-ups.
So I tried to add pull-up resistors, I tried everything 10k, 4k7, 2k2, 1k. I can see the signal improving by scope from 10k to 4k7, but at 1k I don't see much difference, the slope from the buffer is to slow I guess, even at 100kHz. I will try tommorow with lower frequencies because I think the buffer doesn't support high frequencies. Or is it safe to put lower value resistors?

[SOLVED] Read reply for this incredible story.

MQTT / Re: Working with ListOfByte
« on: September 28, 2017, 03:57:57 am »
The listofbyte object has also lots of methods that start with ExtractTo like ExtractTobyte, ExtractToShort, ExtractToFloat, ExtractToInteger with an Endianess option. Just give the index in the list of bytes as a pointer from wich byte in the sequence you want to decode. Very easy and straightforward.

Verstuurd vanaf mijn SM-G9350 met Tapatalk

mc-Dev Board / Re: UART console example not working on mcMod120
« 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?

mc-Dev Board / [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.  ???

mc-Dev Board / McModule not recognized.
« on: July 31, 2017, 02:51:46 am »
I always need to power on the mc-module separately via the switch "module power" otherwise the module isn't recognized via the connect-tools and "Testboard Gateway" wich seems to be the Dev-board.
I can see the mc-Module is boot up if I go to the other gateways though.
But turn the switch "module-power" off and back on solves the problem.

My gateway worked at first but then I started to do all kind of updates: ( it has been while ago I did this )
First I update all my McModules to VM Version:1v08r376  :)
Than I updated my firmware of my gateway hostprocessor to v. 0.8-24 via the USB stick.   :)
I tested again, but could connect to my gateway again but not to any of my McModules  :(
So I thought ok, I must also update the McModule on my Gateway, but I did it the same way as my other mcModules instead of using the mcGw110.bin
So I erased the data-store and updated with the normal McMod110xxxx.bin   :-\
After that I couldn't find my gateway anymore in mcStudio although all the Led's shows normal and I can see my gateway is connected via Newt-Pro.
Than I realized I used the wrong firmware and tried to flash the McDongle on the correct firmware: mcGw110.bin but no luck:
I got the message : Total firmware size exceeds free upload space available in the device. Unable to proceed the update  ???
Help I'm stuck !!! ::)

OK, solved it:

I just chose the wrong file in mcOTAupdater  :P
Mixed up mcGw110.bin and mcGwHost110.bin

I thought maybe to remain this message instead of deleting it. So you can read my stupidities and maybe also solve yours ;)

mc-Module / Re: [SOLVED] SPI problems
« on: August 13, 2016, 11:33:34 am »
Just found out that the Voltage-level of the output pins is typical 3V and not 3V3, so I need to buffer my SPI-CLCK and MOSI signal to steer my 5 Volt WS2801 LED's  :-\

I will use the: SN74HCT125N I guess?

Thanks for the updated version with the possibility to reset the script, that did the trick  ;D

All my bricked modules are working again now, thanks  ;)

mc-Module / Re: Possible range between McModule - McGateway
« on: August 13, 2016, 11:24:19 am »
I just tested the modules for distance and I must say I can hardly go through 1 wall.
I sincerely hope that in the future the Gateway will have a bigger and stronger antenna so the whole network of MC Modules can benefit. ;)

Also an option for external antenna on the modules. If anybody knows how to do a mod to an UFL antenna I want be the first to know ;)

Pages: [1] 2