This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Data received on Hyperterminal from eZ430-Rf2480. Is it corrupted??



Hi, Currently I am working with eZ430-Rf2480, I am able to setup basic network according to document "eZ430-RF2480 Quick Start Guide (Rev. B) (swru152b.pdf)"

I can see node properly connected and showing temp. and voltage using "Sensor monitor application".

But now if I close sensor monitor and open hyperterminal to see what data eZ430-Rf2480 is sending over serial.  I am getting some

garbage as shown in following image.

So, I tried to debug by writing small application to print received characters in hex, and here is the output,

| (0) | fffffffe | �
| (1) | 08 |
| (2) | 46 | F
| (3) | ffffff87 | �
| (4) | 01 | 
| (5) | 00 | 
| (6) | 01 |
| (7) | 00 | 
| (8) | 02 | 
| (9) | 00 | 
| (10) | 17 
| (11) | 18 | 
| (12) | ffffffc4 | �

where " | no.of received character | hex value | character |".

So I am not getting what this data is? Is it a corrupted data? then how sensor monitor show correct temp. and voltage? Or did I am missing anything.

How can I get proper data on hyperterminal?

 

Thanks for your help.

 

Thanks and Regards,

Shivdas

  • Hello,

    I am currently working on my Master Thesis using cc2480 and, just some days ago, I had the same problem than you. The point is that if you are reading the serial port dealing with data as if they were ASCII code you will get that error since there is no ASCII symbol over 0x80 (so, to simplify, they ignore the first bit). I am using VB.NET to develop my own application. Take a look to a part of my code in case its usefull for u:

    (Using VB I solved the problem by using coor.ReadByte instead of coor.ReadExisting as it deals with data without ignoring that "first bit")

    Private Sub coor_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles coor.DataReceived

            Dim octeto As Byte

            Dim hexa As String

     

            octeto = coor.ReadByte

            hexa = ConvertByteToAsciiHex(octeto)

            If hexa = "FE" Then

                contador = 0

            Else

                contador = contador + 1

            End If

            If contador = 1 Then

                longi = octeto

            ElseIf contador = 2 Then

                comando1 = hexa

            ElseIf contador = 3 Then

                comando2 = hexa

            ElseIf contador = longi + 4 Then

                tramita = CrearTrama(longi, comando1, comando2, data)

                representar(tramita)

            ElseIf contador <> 0 Then

                data(contador - 4) = octeto

            End If

        End Sub

  • Hi Shivdas,

     

    Have you tried the default hyperterminal settings, making only one change.  Set the baud rate to 9600.

     

    Hope that will help.

    Cheers,
    Yoda

  • Hi Yoda,

    Yes, I am always tring with Default Baud rate 9600, but no effect on output?

    I have a eZ430-RF2480 kit and I flashed all battery boards with ZASA sample application.?

    Now if I start co-ordinator and configure a router/device, I starts getting this messages on Hyperterminal.

    I think, there could be some way, this sensor monitor sends some command to get proper data and displays it properly?

    BTW, still I am not sure, Do I needs to write 3 different customized programs(one for coordinator, one for router and one for end-device) based on ZASA sample application, and flash these on battery boards so that I will be able to setup my network(not with s2 key pressing)?

    Thanks for your help.

    Thanks and Regards,

    Shivdas Gujare 

  • Hello Gonzalo, I'm Brazilian, and noticed that your code is done in Portuguese. But would like a help if possible.
    My error is the same as occurs with Shivdas. I tried to use the code now but there are some functions that do not have it as  "representar" and "CrearTrama". Is how you move me?
    Thanks

  • Hi Giancarlo,

    Its not exactly portuguese, its spanish, but anyway its quite similar.

    I use a class called Trama. The function" crear trama just assign values to the different attributes of a trama object. The function code is simple:

    Private Function CrearTrama(ByVal lon As Byte, ByVal com1 As String, ByVal com2 As String, ByVal dat() As Byte) As Trama

            Dim NuevaTrama As New Trama

     

            NuevaTrama.longitud = lon

            NuevaTrama.comando1 = com1

            NuevaTrama.comando2 = com2

            NuevaTrama.datos = dat

            NuevaTrama.fcs = NuevaTrama.longitud Xor ConvertAsciiHexToByte(NuevaTrama.comando1) Xor ConvertAsciiHexToByte(NuevaTrama.comando2)

            For i As Integer = 0 To NuevaTrama.longitud - 1

                NuevaTrama.fcs = NuevaTrama.fcs Xor NuevaTrama.datos(i)

            Next

     

            Return NuevaTrama

        End Function

    The function "representar"  just read the comands within a frame and, depending on which one they are, do one thing or another. The code is as follows:

    Private Function representar(ByVal tram As Trama)

            'Caso "Start Confirm"

            If tram.comando1 = "46" And tram.comando2 = "80" Then

                PreguntarNodo()

                'Caso "Recibir Datos"

            ElseIf tram.comando1 = "46" And tram.comando2 = "87" Then

                If Not PruebaPaternidad(nodito, tram.datos(0) + tram.datos(1) * 16 * 16) Then

                    nodito.HijosShortAddress(nodito.NumeroHijos) = tram.datos(0) + tram.datos(1) * 16 * 16

                    nodito.NumeroHijos += 1

                    Dim hijo As New Nodo

                    hijo.ShortAddress = tram.datos(0) + tram.datos(1) * 16 * 16

                    hijo.temperatura = tram.datos(6)

                    hijo.voltaje = tram.datos(7) / 10

                End If

                SetText(vbCrLf & "DATOS RECIBIDOS" & vbCrLf, textoEvento.BackColor)

                'Cuidado: El byte de más peso es el datos(1)

                SetText("FUENTE: 0x" & ConvertByteToAsciiHex(tram.datos(1)) & ConvertByteToAsciiHex(tram.datos(0)) & vbCrLf, textoEvento.BackColor)

                'Subcaso "Recibir voltage y temperatura"

                If tram.datos(2) = 1 And tram.datos(3) = 0 Then

                    SetText(tram.datos(6) & " ºC" & vbCrLf & tram.datos(7) / 10 & " V", textoEvento.BackColor)

                End If

                'Caso "Respuesta de ZB_READ_CONFIGURATION"

            ElseIf tram.comando1 = "66" And tram.comando2 = "4" Then

                Select Case tram.datos(1)

                    Case 135

                        nodito.tipo = tram.datos(3)

                        Select Case nodito.tipo

                            Case 0

                                SetText("", Color.FromArgb(255, 221, 213))

                            Case 1

                                SetText("", Color.AliceBlue)

                            Case 2

                                SetText("", Color.LemonChiffon)

                        End Select

                End Select

                'Caso "Respuesta a Short Address"

            ElseIf tram.comando1 = "66" And tram.comando2 = "6" Then

                If tram.datos(0) = 2 Then

                    nodito.ShortAddress = tram.datos(2) + tram.datos(1) * 16 * 16

                End If

            Else

                SetText("#", textoEvento.BackColor)

            End If

            Return 0 'si no pongo esto me da un warning

        End Function