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.

RS232 to PIC

Hi Guys,

I was wondering on if I can get any info or help; I am planning to communicate using the DM355 via a RS232 port with a PIC16.

Any help will be highly appreciated

 

Cheers

 

  • saadia said:

    I was wondering on if I can get any info or help; I am planning to communicate using the DM355 via a RS232 port with a PIC16.

    Any help will be highly appreciated

    What type of help are you looking for specifically?

  • Whatever is availble on this topic. Like anyone else might have tried so any clues? or Ideas on how to go about and what to look specifically for like what filesystems in the DM355? And ideas on how to go about starting it. As I am a complete newbie.

     

    Thanks

     

  • DM355 kernel has UART0 enabled by default and it is normally used as the consloe window for the target (e.g. displays output useful in  debugging, accepts input).  If you want to keep using UART0 for this, than you need to enable UART 1.  The following post may help with this task

    http://community.ti.com/forums/p/2425/9172.aspx#9172

    That said, once enabled, you can architect your PIC-based kernel driver to use it. I am not too familiar with PIC part; does it come with a Linux driver already which you can start from? otherwise, you may need to write your own PIC Linux driver.

  • Basically I am using a EasyPIC5 board you can google it. This board has a RS232 conector. I don't know about the Linux driver, I believe it doensn't have this.

    I will drive an OLED display from the PIC board which is already done,and now I want to interface this board with the DM355 SDK, so that I can instruct the PIC from the processor  via RS232 to switch ON or OFF the display.

    You said I need to write my own linux driver, any help on this is appreicated as I have no idea on how to do that.

     

    Thanks

  • This changes things a bit as I was envisioning your own hardware board with both DM355 and the PIC part on it.

    If you are using standard of the shelf boards such as DM355 EVM and EasyPIC5, then you have to take into account the connectors already present on those boards (when you design your own board, you can choose connectors for your design).  Both DM355 EVM and EasyPIC5 board appear to have RS232 connectors.  Now we just need to make sure that if we use those connectors to connect EVMs, the software is in place for them to speak the same language (e.g. DM355 to send requests to turn on/off display in a manner EasyPIC5 can understand). 

    That said, I can advise you from a DM355 EVM point of view; however, I am not familiar with EasyPIC5 board and truly do not have the bandwidth to learn about it; perhaps someone more familiar with the EasyPIC5 board will jump in and offer their advice.  From a DM355 EVM perspective, the only RS232 connector is driven by UART0 peripheral and is used as the output console for the DM355 EVM.  This means that if you write a small C program that has a printf command, that printf command will be sent via UART0 to RS232 connector to whatever is on the other side (e.g. PC running serial terminal program such as teraterm, or EasyPIC5 board).  Therefore, this may be as simple as writting a C program with printfs to send requests to PIC board, assuming EeasyPIC5 board has all the software necessary to receive request (again I am not familiar with PIC board).  FYI, the software does not have to be Linux, it can be whatever comes with the PIC board so long as both boards abide by RS232 protocol (e.g. speak the same language).

    Let me know if this helps.

  • ok good. So I dont need linux drivers.

    OK the info u gave is quiteuseful. But how will I make them speak the same language.

    FYI; The EasyPIC5 board came with a software name: MikroC, its C compiler for this board and using this compiler I have initilised the display.

    So do I have to write program in this compiler which will intrepret the TI's commands?

  • The protocol (e.g. language) is pretty much standardized; this is how we can communicate with a serial terminal application running on PC which has no knowledge of DM355.  There are configuration options which both boards should agree on; by default, the DM355 EVM is configure to


     Bits per Second: 115200
     Data Bits: 8
     Parity: None
     Stop Bits: 1
     Flow Control: None

    but these are easily configured to other settings via u-boot command.  My guess is the EasyPIC board has some type of UART/RS232 driver already (if not you will need to write one); if so, you will just need to make sure it is enabled and running (likely by default) and that the configuration is compatible.  If boards are set to have different baud rates (EasyPIC5 set for something other than 115200), communication may fail.

     

  • Thanks for the advice.

    The EasyPIC5 board has the driver installed already. I want to ask another thing; As I said above I am controlling the PIC using the DM355, so I want to send commands using the RS232 saying the PIC to Switch ON or OFF the display...so what sort of programming and techniques do I need to do so that when then DM355 sends 'ON' the PIC recognise it as switching ON the display and when it sends 'OFF' the PIC recognise it as switching OFF the display.

    Thanks again.

  • I would try writting a simple program which sends commands via printfs.  For example if the command code is "ON"

    printf("ON");

    should do the trick (or at least it is worth a try).

  • Ok thanks alot Juan.

    I understand the hardware connections now.

    I want to understand how does the PIC will understand the commands from the TI? The PIC should be able to recognise that DM355 is asking it to switch ON or OFF the display. So what sort of instructions messages I have to write in the DM355 which is recognisable by the PIC? I mean I want to understand the programming side of this now. 

    Thanks again for prompt replies.

  • not being familiar with the PIC side of the hardware or software it is hard for me to say.  The way I envision this is that some software component (driver or otherwise) is running on PIC board which has the function of receiving and procesing data via RS232 port.  Hence the question would be what command format is the PIC expecting via RS232 (again, not familiar with PIC side of the equation).

    If we assume PIC is waiting for a command code of say CMD4, then running a program that includes printf("CDM4") on DM355 EVM would send this string via RS232 to PIC.  If the command code is "ON" as I thought you suggested in your previous post, then running a program which includes printf("ON") on DM355 EVM would send that string across RS232 port to PIC EVM....

    The question now becomes what is PIC board expecting, something which I cannot answer since I am not familiar with PIC board.  I can help with DM355 EVM side, but you will need to figure out PIC portion.

  • Thanks for quick replies.

    I have attched a block diagram for what I intend to do.

    Please have look and suggest me on the DM355 side of the diagram. For example how is it possible?is there a better way to do it? etc.

    Thanks again.

  • They say a picture is worth a thousand words. 

    What I had in mind was a little simpler (use same UART0 port to send "ON" and "OFF" commands to PIC.  For example, 1) boot up with UART0 connected to PC, 2) write a small C program that accepts RCU input to determine which command to printf via UART0 (e.g. 'left arrow" for ON, right arrow for OFF) 3) run program, 4) disconnect UART0 from PC and connected to PIC.  5) Use RCU to send requests... The interface demo source code should give you a good starting point for accepting RCU requests if you choose this approach.

    To implement what is in the diagram you sent, you will need to

    1) build your own board or at least a daughter board to sit on top our DM355 EVM which connects UART1 to RS232 connecter (the only one on DM355 EVM is connected to UART0)

    2) Enable UART 1 port in the Linux kernel and rebuild kernel (this can be tricky, but there sre forum posts on this topic already)

    3) write a small program that can receive data via UART0 and echo it onto UART1

  • Hi,

    I have now programmed the PIC in such a way where when it recieves '1' via RS232 the display initialises and when it receives '0' via RS232 it switches off the display. I have tested this functionality using the hyperterminal in the PC. 

    Now I want to do programming in the Dev Kit as Juan mentioned using RCU. Can anyone help me on this?

    Thanks

  • There is an demo (called interface) that uses RCU on our EVM; please refer to the

    dvsdk_1_30_00_41/demos/dm355

    folder; I am thinking this would be good reference code to start from.