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.

Write/Read Registers on DM3730 through embedded linux

Other Parts Discussed in Thread: DM3730

Hi there,

I have a Beagleboard xM running an ubuntu linux set up by the Matlab/Simulink Support Package. Now I build a audiocodec expansion board for it, which I'd like to use. For that I need to make changes in the McBSP2 Registers of the DM3730 but I can't find any documentation on how to do so. I soon should be able to run c-code on my Beagleboard (setting up everything right now) but which libraries can I use to set up the McBSP Interface? Do you have any documentation or informations on how to do that? 

Any help would be really appreciated since I am quite overchallanged with the embedded linux.

King Regards

Lennart

  • Hi,

    Moving your post to right forum to be better answered.

    Thanks & regards,
    Sivaraj K
  • Hi Lennart,

    I suggest you to look at the AM/DM37x Technical reference manual section 21.6 McBSP Register Manual which can be found at the link:

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin,

    I allready have the Technical Reference Manual. My Problem ist not which Registers I have to set but how to set them. I want to write c-Code that I will execute on the embedded linux OS on the DM3730, but is there any libary so that I can use the Register Names shown in the Tech Ref? Or is there another way to tell the DM3730 which Registers I want to be set? I ask this question especially in consideration of having an embedded linux. Do you probably know of any file that allready sets the Registers on the Beagleboard xM?

    Regards,

    Lennart
  • Hi Lennart,

    There are 2 possible approaches. First  one is a dirty solution & second one is the right approach to solve your problem.


    1. use devemem2 utility on Linux [build it for your target & use, if it  is already not available with your package].
        devmem2 ADDR w VAL
       use corresponding ADDRESS of register & desired VALUE to it. 
      A small user space program with right understanding of TRM mentioned by Tsvetolin should do.

    2. Get inside the Linux kernel and modify mcbsp2 registers there. Again you need to understand TRM.


    Both the cases,  Register Address can be used as reference.  Even though you can map register name in Linux source wth TRM, it may not be exactly same as TRM.  So, its clear if you use register address.

    Thanks

  • Allright. Thanks for the answer. Any chance you knoe where to find these files in the ubuntu file tree installed by the Matlab Support Package?

  • Hi,

    devmem2 is a utility and will be available in Filesystem  package, if it is realased by TI.


    Ref: http://www.makelinux.net/books/embedded_linux_kernel_and_drivers/text152 this link for more details

  • Hey Ravikiran,

    thank you for the advice with devmem2. I just installed it on the board and used it the first time. Works pretty good! I had to realise that if I build a simulink modell (lets say to write to a GPIO), when I execute the modell, registers are getting changed by the modell. For example the register for GPIO 168 ist by default set to be I2C, but as soons as I execute a modell that writes to the GPIO_168, it changes the state of that register, so that it becomes a GPIO instead of I2C. This is pretty much what I want to do myself. It would be perfect if I could include c-code in a simulink modell that changes the registers as desired and furthermore give me a bunch of in- and outputs for the audio data so I could process them with simulink.

    Is it possible to do that with s-functions? I think executing command prompts (like devmem2) should be possible in a c-file isn't it?

    Thank you so so so much! You just gave my project a huge push!
  • Hi,

    nice to hear +ve reply from you.

    To answer your questions,

    devmem2 is a test utility. Of-course, it can be called from a script or C code.  But why to do that? there are better alternatives & hence I won't recommend it to use in your code.

    • You would like to configure it as GPIO permanently. You don't want to switch it back to I2C? I understand so. Please confirm
    • If answer to above question is yes, then you can configure it to be a GPIO during boot. [Refer; Architecture specific file & mux configs]
    • Also, you can try to do ioremap on that particular register and configure as per requirement.

    PS: If you are an Application guy,  then take help of Kernel guy to acheive it. or you may have to explore these linux stuffs yourself.

  • Hi


    To answer your questions:

    The whole I2C-Problem has already been taken care of. I just used the i2c-interface from a different Expansion Header. But the problem pretty much stays the same. I would like to write to the McBSP-Registers. Having during boot would be grate, the only question than would be, how I could access it with Matlab Simulink or C-Code.

    I will have a look into ioremap for I don't really know what is now. Is that a c-libary or a command prompt?


    Unfortunately there is no kernel guy around here. I got to get it done myself. Why wouldn't you recommend using the devmem2-tool? I thought I could make something like a batch file that runs on startup and sets all the registers with devmem2.

  • Sorry for confusing you further.


    If you want to use devmen2 Only Once in a While in your setup, then you can use it.  I was worried only about performance numbers if you use it frequently.  

    Since you are planning to use it only during boot yo can go ahead. But to keep you informed, there are better solutions available than devmem2 if you like to explore. Otherwise deveme2 should be sufficient for your requirement.

  • Please don't be sorry. Everything is a usefull information since -- as everything -- my project is not just black and white ;)
    I think devmem2 will be ok for the general setup of the McBSP Interface (nevertheless I don't mind to get to know the nice way of doing this. Might happen that I do it that way some other day). It just came to my mind that I have to read the incoming values from the DMA for what it might be very usefull to use something different than devmem2. I will definitelly get back to you quite soon. For now I will try to get as far as possible with devmem2.

    Thank you very much for your help!
  • Hi Ravikiran,

    I guess devmem2 really isn't the way to go. I forgot that I have to load and unload the buffers of the mcBsp2 Interface quite often and will defintelly require interrupt handling for that. I guess I can't do that with devmem2 right. Is their a chance that I can do that with mmap()?
    Do you know whether I could use a user-space c-file as a source for ALSA?

    Regards,

    Lennart