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.

cc2530 - c# application for UART (COM)

Other Parts Discussed in Thread: CC2530, Z-STACK, CC2531, CC2530EM, CC2511

Hi there,

I tested CC2530 that via IAR embedded workbench. One of the IAR provided example by TI was "Light Switch". 

Now I want to implement an application in C# and communicate with CC2530 via COM Port. I know how to implement that in C# and also the TI provides the specification  like baud rate, parity and etc on CC2530ZNP Interface Specification.pdf. The problem is that I don't know which message I should send to my board to switch on the light (for instance).

Is there any body who has the similar experience ?

Regards

Bam

  • Hi,

    are you using one of the Zigbee (Z-stack) examples, or some other software example for CC2530? Please let me know where you found the example.

    I would recommend to take a look at the TI packet sniffer tool. This tool let you see the messages going on the air.

    http://www.ti.com/tool/packet-sniffer

    Thanks,

    Bjørn

     

  • Thanks Bjørn

    Right now I don't want to sniff the RF packets. I just want to send a simple message to my board via COM Port (USB). Now the board has programmed via IAR for switching on the light.  Which command will initializing the board ? Is there any specific protocols for messages which the board receives? Is there any example (open source) in c# to communicate with the board?

    Thanks

    Bam

  • Hi,

    Do you have a link to where you found the CC2530 software example? It would be helpful to understand which software examples you are working with.

    Thanks,

    Bjørn

  • Hi

    here is the link: http://www.ti.com/tool/cc2530dk and the PDF (CC2530 Software Example's User Guide) is : http://www.ti.com/lit/ug/swru214a/swru214a.pdf 

    thanks

  • Thanks,

    The ZNP interface specification is not relevant for these examples.  That document is relevant only for the CC2530ZNP devices (ZigBee Network Processor). The software you are using is not ZigBee software. If you want to use this example you will have to extend the software with a UART handler to be able to receive commands on the COM port. Since you define both sides of the serial communication the protocol is up to you. I do not think we have a UART example ready that is compatible with this software unfortunately.

    Regards,

    Bjørn

  • Thanks Bjørn

    I was thinking about the same point, Because I couldn't see the active COM port in Tera Term software. 

    OK, How can i add UART handler?

    Thanks

    Bam

  • One more question, do you offer me using another software which is able to communicate COM port?

    Is there any available one compatible with ZNP interface specification?

  • You can try with the attached c file. You will have to add this file to your IAR project, and also include "hal_uart.h" (this file is already in the package in this folder source\components\targets\interface) in your code. You should then be able to use the UART functions defined in hal_uart.h. I can not guarantee this is working directly, but at least you have a starting point.

    Probably it is easiest to try sending on the UART from CC2530 first. You then need to call halUartInit first, and then halUartWrite().

    Bjørn

  • Hi Bamshad,

    I do have an application code of CC2530 ZNP which I am using for CC2531 EMK USB Dongle. It currently enumerates the USB as a CDC Device (Virtual Com Port).

    As Bjorn suggested you will have to define your own protocol for the COM communications. I can send you the required source files after stripping out the IP code of our company. But it will take me a couple of days for that. Let me know if you need them

    Are you familiar with Zigbee? Endpoints? Clusters? Profile? etc..

    Regards

    Royston

  • Thanks,

    i added these two files to switch light project and compile and debug it. so the CC2530 is programmed by UART handler. But still I cannot see the device in Tera Term. I Mean that the device is plugged but there is no Active COM port. Did I mess anything? or I have to install some special drivers? I used the simple USB cable to plug the board to my PC.

    Appreciate your kind help

    Bam

  • Hi Bamshad,

    On going through the thread again, I noticed you were using CC2530 for USB application? Which board are you using.

    As well you can just use the CC2531 EMK programmed with ZNP and use the ZTOOL. I assume you want to make something similar like ZTOOL.

    ZTOOL follows the ZNP protocol to send data to the CC2531 EMK, which is something you need to develop in C#.

    Regards

    Royston

  • Thanks Royston

    I have a simple zigbee board and the micro controller is CC2530. I want to transmit data via this board to another board via ZigBee protocol.

    But right now is enough for me to send some simple charecter to the usb plugged board (CC2530) via terminal software like tera term. Just test that works or not. I guess there should be a simple solution which allow me call the cc2530 via COM Port. Isn't there?

    Thanks

    Bam

  • Hi,

    CC2530 has no USB module in it (CC2531 has). I'm not familiar with any TI evaluation board involving

    CC2530 with USB capabilities. If you are talking about smartRF05EB + CC2530EM, then the USB

    interface on smartRF05EB is for the CC2511 controller on smartRF05EB. There is also the mini ZNP

    but this is a combination of MSP and CC2530 (again no direct access of USB interface to CC2530).

    What you might get working is to hook up CC2530's UART with USB<->Serial cable

  • Thanks Igor,

    I have CC2531 plugged by USB cable. The driver is also installed but again I have the same problem. I can not see any active COM port on the Tera Term.

    How can I find an example which communicates with CC2531 via COM port?

    will appreciate ur help

    Bam

  • Hey,

    If you have the Z-stack installed, go to "...\ZStack-CC2530-2.5.0\Projects\zstack\ZNP\CC253x",

    then open znp.eww with IAR. Select CC2531 - Debug project (you can find it in the left side window,

    upper corner -> drop down menu).

    Connect your CC2531 dongle into USB, then connect the dongle to smartRF05EB  (or CC debugger,

    depends on what tools you have) with a flat cable. Turn on smartRF05EB, the LCD should be

    displaying "something" "something" "CC2531" (Press the push button on CC debugger, then the LED

    shall turn green).

    In the IAR press Ctrl+D, once the download process is finished, press F5.

    In the Tera term issue a SYS_REVISION request (refer to ZNP document for more details), which

    should be (hexadecimal numbers) 0x00 0x21 0x02

  • Thanks Igor

    I used also USB<->RS232 cable and communicated with CS2530 on tera term.

  • Hi Bamshad,

    Just to clarify; The UART code I sent is for using the RS232 connector on the SmartRF05EB board directly (not UART over USB).

    Bjørn

  • Hi Igor,

    Sorry, I've missed sth in my past explanation. I have SmartRF05 Evaluation Boards and connected it with RS-232 to my PC COM port. Now I can see the active PORT on TeraTerm (Hyper Terminal Software) . I installed Z-Stack also and from this directory [C:\Texas Instruments\ZStack-CC2530-2.5.1a\Projects\zstack\Utilities\SerialApp\CC2530DB] I load the built hex file by IAR to my board (Via USB cable). Now I'd like to send a command from my PC to the board. and receive the same thing on my terminal software (echo) . First of all when I send a command from PC to board the red light of RS-232 will turn on and it means failure in COM communication as I know. second is there any possibility to send the command to the coordinator and the coordinator broadcast it to other endpoints? I should load the same code for endpoint boards?

    is there any document or pdf which explain how can I test the SerialApp?

    Thanks and appreciate ur help

    Regards

    Bamshad

  • Hi bam a, 

    If you can tell us what you have achieved and what you really don't know how to do the next will be better.

    Let me tell you how you can do it quickly because I just did somthing similiar these days.

    1. First make sure you know there are many documents talk about Z-Stack in your installed directory:(C:\Texas Instruments\ZStack-CC2530-2.5.1a\Documents).

    2. Read the most related docs:

    • CC2530ZNP Interface Specification.pdf
    • Z-Stack Monitor and Test API.pdf

    3. Test with Z-Tool (C:\Texas Instruments\ZStack-CC2530-2.5.1a\Tools\Z-Tool).

    • program your CC2530 with ZAP image (C:\Texas Instruments\ZStack-CC2530-2.5.1a\Projects\zstack\ZNP\CC253x)
    • open Z-tool. Note: you must need some change to Z-tool default configurations.  "Tools->Settings->Serial Devices", select the port and double-click to change "rate" from 38400 to 115200bps. Also click "Enable" to enable the port be scanned.
    • select Main Memu->Tools->Scan for Devices to scan the CC2530ZNP device (CC2530 programmed with ZNP image). You should get the device window.
    • If no device found, there may be: (a) the wrong COM port enabled or baudrate configured; (2) when you use USB-serial adapter, make sure it has fully functional pins (with Hardware Shaking pins connected).  So I sugguest you use PC RS232 COM port connected to CC2530 directly at first.
    • If devices found, click the commands listed in left, and play with messages defined in documents. Send "SYS_VERSION" to check the interface.

    4. What did I do in the right way?

    • Mod the original ZNP project  as following:
             The default transport interface is SPI enabled in hal_board_cfg.h.
             Ln92~93 should be modified to enable UART.
             Flow control should be disabled for USB-serial adapter usage in function
             znpInit() located in znp_app.c file.

    5. How can we implement C# in easier way?

    Use the existed .Net library DLL filed located in C:\Texas Instruments\ZStack-CC2530-2.5.1a\Tools\Z-Tool. This is well designed interface implementing all APIs defined in documents. Z-tool uses them and you can get them help you also. Btw, I don't test this but I believe it should work for you.

    Hope these help.

  • Hi Joey,

    That works. Thanks for the kind help. I figured out the communication problem is because of hardware hand shaking. It was disabled on my hyperterminal. 

    Thanks for the nice explanation. I will share my experience here for others also.

    Regards

    Bam

  • Hi

    Is it possible to do the same thing as Bam using TTL interface.
    It consists of only 3 pins ....Tx, Rx and GND ,
    Z-Tool don't recognise my device.
    I use FTDI cable.

    And Bam do you have some example code (for instance led on/off) in c# ??

    Regards

    Tom

  • hi,

    I am using cc2530ZDK for my project. in my project i need to log the data for all the day..but the kit stops responding after around 2hrs 30 min and the zsensor monitor software shows "sink no response". how to solve this problem and make the sink respond continuously..