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.

CCS/AM3358: Profibus Master issue

Part Number: AM3358
Other Parts Discussed in Thread: PROFIBUS

Tool/software: Code Composer Studio

Hello,

I want to boot my am3358-based platform with profibus master application from SD card. I want to know what should I do step by step to in order to run application in details? 

I created SD card image of TI-RTOS SDK and I copied prebuilt binary file of profibus master application (app) into my SD card. When I inserted SD card in my board, booting procedure failed and stopped. 

Thanks for your attention.

 

  • Hi Hossein, what is the error? or can you give us more details of the failure you are observing?

    Also, in PRU-ICSS Profibus Master User Guide I see PSDK version required, for current  PRU-ICSS-PROFIBUS-MASTER  01_00_01_00  is PROCESSOR-SDK-RTOS-AM335X  04_00_00_04

    If you are using this one, then it is OK. if not, please create the SD card with this version. Also please use SD card SBL (a.k.a MLO) from this version

    MLO can be found at: C:\TI\processor_sdk_rtos_am335x_4_00_00_04\prebuilt-sdcards\evmAM335x\sd_card_files

    For booting from SD card you just need the correct version of MLO and  Profibus master binary "app".

    You can build Profibus binary, or for a quick test you can use our prebuilt binary from 

    http://software-dl.ti.com/processor-industrial-sw/esd/PRU-ICSS-PROFIBUS-MASTER/latest/index_FDS.html 

    Thank you,

    Paula

  • Hi Paula, I followed exactly the same steps as you mentioned. My target platform is beaglebone black and when I power it on and press S2 to boot from SD card, the booting procedure stops at unknown step. Last time that I  tried  to boot my board, I saw the following comment on the terminal:

    "waiting for jumping to starterware ... "

    Booting procedure stopped at this step and did not continue. 

    Thanks for your attention,

    Hossein

  • Hi Hossein, BBB is not one of the OOB supported boards.

    You can check supported platforms list in PRU-ICSS Profibus download webpage 

    There is one user who successfully ported Profibus slave (E2E thread for your reference) and he is working on making it available in Github. His work was in slave, but maybe there are some tips that can be used for Profibus Master.

    thank you,

    Paula

  • Hi Paula,

    Thanks for your answer,

    Is there any way to run profibus master app in BBB? 

    I installed a rs485-to-ttl module beside my BBB in order to capture profibus data from uart ports. I could sniff profibus data by using this module and  a python application on debian linux running on my board. Now, I want to implement profibus master on my BBB. What are the limitations? Can I remove these limitations?

  • Hello,

    As Paula said above, I adapted TI's Profibus slave example to run on the BBB. I want to write a step-by-step guide for everyone to be able to do it, but I did not have the time yet.

    Since you seem to know your way around TI-RTOS, the PDK and all I think I can try to quickly explain here and you can give it a go. It is actually quite easy.

    First off, you need to introduce several modifications on the PDK (they are mostly pinmuxes and headers). I have attached below the files you need to change on a zip package with the same folder structure you have on your disk's PDK path.  If you want to know what these changes are about you can take a look at this application note which explains how to modify the console UART for the BBB. What you have to do for the Profibus examples is very similar, but it has to do with the PRUs, of course.

    I cannot guarantee it, but I think you can safely overwrite the original files; nothing bad should happen. If you want to be sure, make a backup of the original files and/or folders (if something gets screwed, you can always reinstall the PDK, so the risk is quite low anyway).

    Once you have the files in place you need to recompile the PDK with:

    make all

    If you've never done that before you'll have to set up the environment but that's quite straight forward (you can find excellent documentation on TI's wiki pages). Note that you need to recompile everything, including the bootloader. If you boot from an SD card you need to replace the existing MLO file with the new one that you just compiled and should be stored in the following folder:

    pdk_am335x_1_0_15/packages/ti/starterware/binary/bootloader/bin/am335x-evm/gcc
    

    You have to use the "_ti.bin" file, rename it to MLO and copy it to the SD card root folder. I prefer to send the APP file via UART (so I don't have to keep plugging and unplugging the SD card) so I use the image with the "uart" in its name as my MLO file (I boot from an SD card, but this way I only need to remove the card from the BBB once). If you prefer to boot the binary app from the SD card you'll have to use bootloader_boot_mmcsd_a8host_release.bin.

    Now that you have your card ready to boot you need to compile the Profibus examples. I did not test the master (mainly because you need two BBBs, one to act as master and another one as slave or some other slave that I don't have at the moment) but I think it should work the same as the slave. After generating the project with the script provided and importing in CCS you have to change the project properties to the correct board (Beaglebone Black, and don't forget to change the platform to ti.platforms.beaglebone in the Products-->Platform menu), remove or rename the AM335x.lds file (this file contains the memory layout and it is generated if you build the example project using ti.platforms.evmAM3359 as the target platform, so it might not exist on your setup) and build the project. Then you can copy the app file to your SD card or upload the .bin (profibus_slave_AM335x_arm.bin for the slave) via UART.

    As I said, I did not have the opportunity to test the Profibus Master yet but looking at the example I think the limitations referred to in the documentation (you cannot have more than three slaves on your bus and they all have to be the TI slave) are not hardcoded so you should be able to change the code to adapt it to your needs (depending on what your needs are that can take some time and effort).

    Once you have the slave up and running and you can pair it with any PLC master using the GSD file included with the example. You can also use pyprofibus as a master, I've tested it and it works, but you have to use this branch, which is adapted for non-modular slaves (slaves with a single module. I'm not quite sure yet, but there seems to be a bug in pyprofibus that prevents it from running into data exchange if you define 8-byte-long blocks on your slave. That is, unfortunately, the default size of TI's example, so you might want to change that (you need to change it both on the GSD and on main.c, see section 4.4 here for details.

    On the hardware front, you have to use the following wiring: output messages from the slave (and to be able to change inputs and send extended diagnostic frames) will be displayed on UART0, which is the one with male molex pins. This picture should help you set it up:

    The Profibus link will be through UART1:

    -UART1_TX is on P9 pin 24, to be connected to the RS485 transceiver Drive Input (DI)

    -UART1_RX is on P9 pin 26, to be connected to the RS485 transceiver Read Output (RO)

    -GPIO_1_25 on P9 pin 27, this pin will toggle the direction control line on the bus and it must be connected to the Drive Enable (DE) on the transceiver

    -The Read Enable (~RE, inverted) must be connected to GND (on the BBB board or on the master's side, both must be connected together)

    -For the power supply of the transceiver, you can use P9 pin 5

    I know these instructions might not be good enough depending on your experience, just write back if you encounter any roadblocks.

    Good luck.

    EDIT:  As discussed in your other question, if you try to build the libraries using the files in the zip archive attached below you will get an undefined symbol error that you can fix copying the header with:

    /opt/ti/pdk_am335x_1_0_15/packages# cp ./ti/board/src/icev2AM335x/include/board_internal.h ./ti/board/src/bbbAM335x/include/board_internal.h

    pdk_am335x_1_0_15.zip

  • Hi Marcos,

    Thanks a lot for your answer,

    Your response really helped me. 

    I will try it to do again with correction you mentioned above and I will report here the result as soon as possible. 

    sincerely yours ,

    Hossein. 

  • Hello Hossein,

    You're welcome. As I said, do not hesitate to post back if you run into issues or if you have any comments or ideas to discuss. I will be travelling this weekend and early next week but I'll tune in again as soon as possible.

    Regards,

    Marcos

  • Marcos, what a terrific answer!, thank you

    Paula

  • Thank you Paula,

    This was just a first attempt, maybe only good if you know your way around the system. 

    I'll try to complete with much more material soon. As I said, there must be an audience for this.

    Thank you and everyone at TI for releasing great products and tools and supporting them.

  • I followed your instruction exactly, but noting has changed. Booting prosedure stoped at following step:

    "Jumping to starterware Application .... "

    Do you know this error and its source?

  • Hello,

    If you don't even see the initial messages it means there must be something wrong with either the bootloader or the application itself.

    Can you tell me:

    -What is the size of the binaries (the bootloader you rename to MLO and the binary you rename to app)?

    -What version of the PDK are you running?

  • Hello Marcos,

    The size of MLO and app are about 48 Kb and 962 Kb, respectively. 

    Since the profibus master application must be used with "processor_sdk_rtos_am335x_4_00_00_04", the related PDK  package is pdk_am335x_1_0_7. 

  • Hello Hossein,

    I'm on PDK 1.0.15, but I see no reason for your version not to work, I don't think the code has changed that much.

    I'm assuming you are booting from the SD card. The size my bootloader in that case is 54.8 kb, it looks way bigger than yours.

    Did you get any errors when you compiled the library and/or bootloader? You need to look at the output carefully and make sure everything worked out as it should. Maybe it's better if you clean with make clean before recompiling to be sure all libraries are rebuilt.

    I'm not completely sure all options are needed but I compile the bootloader with these:

    make -s bootloader BUILDCFG=boot BOOTMODE=mmcsd PLATFORM=am335x-evm PROFILE=release -s KW_BUILD=no ENABLE_PRU=yes

    Make sure you are in this folder /opt/ti/pdk_am335x_1_x_x/packages/ti/starterware and you have loaded the environment variables with the script.

    After compiling the bootloader check the file size of bootloader_boot_mmcsd_a8host_release_ti.bin in folder /opt/ti/pdk_am335x_1_x_x/packages/ti/starterware/binary/bootloader/bin/am335x-evm/gcc to see if now it's closer to 54.8 kb.

    I'm going to compile the master example now but I won't be able to test it until next week.

  • Hello Hossein,

    I could not build the master example yet, I'm having some issues and I don't have time right now.

    Maybe you can try with the slave in the meantime.

  • Hello Hossein,

    I have compiled the Profibus master example now and my app file is 320.3 kb. I think you have forgotten to remove or rename AM335x.lds, that's the reason you get a much bigger binary file.

    You can also remove it from the Linker command line option in menu CCS General under Project properties:

  • Hello Marcos, 

    I tried it. The size of my app is about 320 KB now, but nothing has changed. I will try it again I  will report you as soon as possible. 

    Thanks you a lot.