Hi,
I´m working with simulink and i tried to use flash memory but when code composer tried to load the program, this error show up. Someone know how to fixed?
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.
Hi Andreas,
Simulink have two types of block, one is for normal programs when you use RAM, the other when you use Flash. Simulink generated C code and then connected to Code Composer who load the C code. You don´t have to configure Code Composer, this is done by simulink.
Gastón
ok - is this flashing block well configured in simulink, i.E. are the clock timings for the flash algorithm ok?
Andreas
OK, I have to admit, I am not familiar with simlunk flash tool.... Did you try to flash the DSP by CCS directly, does this work?
Andreas
I forwarded this to the Mathworks C2000 support team, hopefully they will answer.
Hi Gaston,
Could you please reply with the release of MATLAB you are using. For example R2009b. You can obtain this information by entering the VER command at the MATLAB Command Prompt:
>> ver
Gracias,
-Greg
Hi Greg,
I have the R2010a version.
I have an extra question for you. I implemented a simple perceptron using simulink without problem, but when i tried to implement a backpropagation network an error shows up:
I guess this error is due to the transfer function(purelin in my case). is there a way to avois this?
Hi Gaston,
CCS Flash Loading Issue:
I re-read your posts more closely. It looks like you also had trouble loading the code from the example flash project for the F28027 that comes with the TI Development kits.
Example_28027_Flash.pjt
Did you attempt to load it using CCS On-Chip Flash Programmer?
If this is the case, my ability to assist with the flash programming problem may be limited, and we can ask TI again.
Perceptrons and Backpropagation:
I assume you are attempting to build some sort of neural network.
Are you using the Neural Network Toolbox to develop a neural network, create a block in Simulink that represents the neural network, and then generate code from that Simulink model?
If this is the case, would it be possible for you to provide an example neural network object (saved to a MAT-file) and a Simulink model that produces the same issue?
You can send me an example at greg.wolff@mathworks.remove_this_text.com
Root Cause: The MATLAB Fcn block does not support C-code generation. If the Neural Network Toolbox is creating a Simulink Subsystem that uses the MATLAB Fcn block, I would like to know so we can try to provide a workaround, and try to avoid this behavior in the future.
Hi Greg,
Yes you are right, but i want to program the flash directly from simulink, I want to know if you can check this problem. I have the CCS version 3.3.81.28 and now I can
program the flash (I had to configure the flash in CCS--silly error for my part).
Backpropagation Neuronal Network
I make an easy example of backpropagation neuronal network (Matlab Help) by commands (newff, train, etc) and then generating the simulink model (gensim). When i tried to build this model into simulink (CTRL+B) the error that i show you appears. I would like to know if there is a way to avoid this.
Regards
Gastón
Hi Gaston,
Regarding Flash Programming:
I apologize for my confusion, but I am still not exactly sure what the issue is regarding the Flash Programming. Here is my understanding:
If the above is correct, and you are interested in automating the flash programming as part of the Simulink model build process, the following documentation should help you:
http://www.mathworks.com/access/helpdesk/help/toolbox/targetsupport/tic2000/brubv6x-1.html
You can also access this documentation by entering the following at the MATLAB Command Prompt:
>> web([docroot '/toolbox/targetsupport/tic2000/brubv6x-1.html'])
If you continue to have issues programming the flash after going through the steps suggested in the above documentation, please reply to this thread.
Regarding Backpropagation Neural Network:
Can you reply with the MATLAB Commands you used to generate and train the neural network? The reason the commands might be important is because the function that is used in the MATLAB Fcn block that appears in the generated Simulink subsystem is important. If you provide the commands you used to construct the neural network, there is a better chance I can help you avoid the code generation problem.
Thanks very much,
-Greg
Hi Greg,
Let me explain, I´m working on a Simulink Model that I name it Segundo01. I tried to build this model (Ctrl+B command) but the error that I show you above appears. That is the main problem.
Then I tried to load a simple example using CCS ( Without Simulink ), I not interesting in this because I need to work with Simulink, I just used it to verefy the flash. It work finally. But again, i need to do this with simulink. Why? Because i need more memory space, i'm using the RTDX block ( C2000lib---> RTDX Instrumentation), using a lot of sensor, interface with GUIDE.
Again, i´m not interesting in CCS because all the work I did is in Simulink. I'm not re-configured CCS i just follow the step for prgramming the flash. But this is not the Main problem.
I read the link that you send me, but again i can't build the model. Look this(CCS error):
this is the error that matlab shows:
Questions:
1) Is there an simple example that you can send me (Using Flash in f28027)?
2) Could be a Memory location problem?
I know you don't have to configure CCS, because Simulink did it for you when you build the model (Work in Real time ). Maybe i´m doing something wrong, but i guess that just by adding the Piccolo stand alone memory flash is enought.
This is the first time I'm using Flash with Simulink.
Backpropagation Network
I tried to load this example
http://www.mathworks.in/access/helpdesk/help/toolbox/nnet/backpro6.html
Just try to load this example (generate the simulink model using the command GENSIM(NET,-1)) and you'll see my problem.
Greg, sorry for all this questions, but i really need to do this with Simulink. If you are still confused let me know.
Regards
Gracias Greg
Gastón
Hi Gaston,
I haven't been able to look at the F28027 flash issue yet. However, I can answer your question regarding the backpropagation network.
As I mentioned previously, the MATLAB Fcn block cannot support code generation. Luckily there is a relatively easy workaround.
Workaround for RTW Build Error:
1. Locate the "removeconstantrows_reverse" block located in "untitled/Neural Network/Process Output 1" , if the model is open, you can open this system by entering the following at the MATLAB Command Prompt:
>> open_system('untitled/Neural Network/Process Output 1')
2. Right-click on the "removeconstantrows_reverse" block and select
Link Options -> Disable Link
3. Right-click on the "removeconstantrows_revers" block and select
Look Under Mask
4. Double-click on the "Constants" block to open the parameter dialog
5. Change the Constant Value to
flipud([0; constants])
6. Click "OK"
7. Select the "MATLAB Fcn" block and delete it by pressing the Delete key.
8. Connect the output of the "Constants" block to the input of the "Mux" block. (You are just connecting the lines left behind when you deleted the MATLAB Fcn block)
9. Run the model to ensure you are getting the same simulation result.
Why this Workaround Works:
The MATLAB Fcn block does not support code generation because only a subset of the MATLAB lanquage supports code generation, and the MATLAB Fcn block is designed to provide more general support of MATLAB functions.
In this particular case the MATLAB Fcn block is used to manipulate a vector of constants. This manipulation only needs to occur once, when the vector of constants is defined. By moving the FLIPUD function call from the "MATLAB Fcn" block to the mask of the "Constants" block , the FLIPUD function is only called during the model initialization process which occurs before simulation or code generation. This is different than using the MATLAB Fcn block, which applies the FLIPUD function every simulation time step.
To Prevent This in the Future:
The above workaround only applies to a single instance of the generated neural network. If you would like to propagate this to other similar networks, you can update the Simulink library with the change you just made.
1. Make a backup copy of the original library. You can do this by entering the following at the MATLAB Command Prompt:
>> libraryFullPath = which('neural')
>> [libraryPath, libraryName, libraryExtension] = fileparts(libraryFullPath)
>> backupLibraryFullPath = fullfile(libraryPath, [libraryName, '_backup', libraryExtension])
>> copyfile(libraryFullPath, backupLibraryFullPath, 'f')
2. Locate the "removeconstantrows_reverse" block located in "untitled/Neural Network/Process Output 1".
3. Right-click on "removeconstantrows_reverse" block and select
Link Options -> Resolve Link...
4. In the table select the "--> Push" Action for "removeconstantsrows_reverse".
5. Click "OK"
This action updates the library for this block to include the modifications that you have made to the instance of the library.
Hi Greg,
Thanks for the solution in the backpropagation neuronal network, I appreciate it. Good news for my thesis.
Gracias Greg
Gastón
Hi Gaston,
Regarding the Flash Programming issue, I meant to ask this earlier: Which System Target File are you using for the code generation process for your model?
You can obtain this information by entering the following at the MATLAB Command Prompt:
>>open_system(modelName)
>>get_param(modelName, 'SystemTargetFile')
Or you can go to the Simulation -> Configuration Parameters in menu bar of the model and select the Real-Time Workshop pane.
The name of the System Target File shown should be "idelink_ert.tlc". If this is not the case, please reply with the name of the System Target File that does appear.
Cheers,
-Greg
Hi Greg,
The Sistem target file is idelink_ert.tlc.
I have another question:
How can I know the size in RAM that is occuped by one block in simulink? (I want to know the differences between the RTDX block and If block)
thanks
Gastón
Feel free to continue this and other Mathworks discussions on this forum - I think they are great - but wanted to let others know that Mathworks was nice enough to set-up a dedicated email support for C2000 customers as well:
Hi Gaston,
Regarding your question about RAM usage of a particular Simulink block.
I am assuming you would like to understand the relationship between which blocks you choose in a Simulink model, and their respective memory footprint in the object-code loaded onto the processor.
Why do you need to make a comparison between RTDX and an IF block?
These two blocks in particular serve very different functions. One provides a communication interface and the other affects program flow. I usually encounter people making comparisons of size and execution spreed of different methods to implement the same algorithm.
However, since the question you asked does have more general implications, I will try to provide some additional incite into what is measureable, and what might be difficult.
You can measure memory footprint for a compiled application, and automate that process from MATLAB and Simulink.
The CCS compilation process produces a memory map file that describes the memory allocation for the processor. In the past I have used MATLAB scripts to parse this file and display how much total RAM my compiled application has used. If this is something you are interested in doing, I can share that script with you.
If you measure the entire application size, you can use this to make comparitive measurements of memory footprint between different applications compiled for this processor. You can attempt to use comparitive measurements to estimate the memory footprint of individual blocks, but this is not generally worth the effort.
In general, you cannot precisely determine how much memory an individual block will take up once the generated C-code has been compiled into object-code and loaded onto the processor.
Even if you measure the relative memory footprint size for individual blocks, you cannot assume that the memory footprint for a collection of Simulink blocks will the sum of the memory footprints of individual blocks. It could be greater, or could be less. There are a number of reasons why it is difficult to map particular blocks to memory footprint.
1. The code generated for a particular block in Simulink may appear in multiple functions, header files, etc. For example many blocks have code that appears in the initialization function, and step function of the generated code. These functions could appear in different memory sections on the embedded processor.
2. The context in which the code is generated from the model matters a great deal. There are a number of optimizations that can occur during the code generation process that can affect the code that is generated for a particular block. This can include the adjacent blocks, sample times, and value of block mask parameters defined in the Simulink model.
3. The code generation options you choose from Simulink can greatly affect the output size and execution time of the compiled generated code. For example, there are options that allow for overflow and underflow protection in the generated code when converting between datatypes. Including this option will result in generating additional code at datatype conversion interfaces. Another example is an option for the re-use of intermediate variables. If intermediate variables in the generated code are never reused, then it will require a greater memory footprint.
4. The Code Composer Studio compiler also performs optimizations. Much like Real-Time Workshop, the compiler may also affect how the object-code is generated based on the context of the C-code. Depending on the value of elements, their organization within the C-code structure, and compiler optimization levels, you may have varying memory footprints in the object-code.
I am still working on the FLASH loading issue...I am missing some header files and haven't had a chance to track them down yet. :)
Cheers,
-Greg
Hi Greg,
First of all, Thank you very much for reply and answer my questions. Yes you're right, I'm interested in knowing the memory footprint of each block ( I tried to put an example of this between RTDX and IF). I must review my syntax in english :)
Let me explain, I've connected 5 sensors to the piccolo ( 5 MSP430RF2500 ) , each sensor send me temperature and light data. This data is used by the neuronal network for control (Close loop control). But I need to be able to see this data in matlab, that is why I use GUIDE.
Here comes the problem, all the block I use to separate and identify the sensors data won´t allow me to use the RTDX block that I need to send this data to my mfile program. That is why i´m interested in the memory footprint of each block. I see the size of my model in the memory map generated, also i know that simulink generated extra code ( Could you explain this to me? ). But if you says that is worthless then you´re right. I must review my model and try to optimize it more.
Thanks again Greg
Saludos
Regards
Gastón
Hi Gaston,
Si preferis escribir espanol, puedo tratar que comprender. Mi espanol esta muy mal, pero necesito practicar. :)
If I understand you correctly, you want to send data from the C2000 processor to your MATLAB GUI. You are using RTDX because it is the easiest, and does not require additional hardware.
Is it possible for you to send me the model. I will try to replicate the problem, and then see if I can find a solution.
I don't need the GUI, just the model and other files required for C-code generation.
Cheers,
-Greg
Si comprendo correcto, que queres embiarlos datos del C2000 procesor a tu GUI de MATLAB. Tu estas usando RTDX por que es el mas facil, e no necesitas hardware adicional.
Es posible que puedas embiarla tu modela a mi? Voy a tratar de replicar el problema. Despues espero prestar una solucion. No necisito el GUI, pero solo el modela e otros archivos que los necesito para generacion de C-code.
Hi guys,
almost one year ago you started the discussion because you got a problem trying to flash the f28027 from simulink, I having the same problems.
I'll appreciate a lot if you reply with your solution.
thank you in advance
David
Hi everyone!
I am trying to implement a real time control system with F28035 in Simulink. I am able to control my system with ON-OFF controller but When I use Fuzzy logic controler, -econst variables causes error because the memory range is not enough. So i am trying to boot the codes from the Flash memory but I got the same error(Data verification failed at adress xx). I cant find any solution about this problem. Is there anybody knows the solution?
Hamit,
check my files, there you'll find some simulink models to look. If you are using CCS3 there is a bug when you are using the flash memory. You are limited to use the RAM memory with simulink or you can use CCS3 to program the flash (Tools ---> F28xx On Chip Flash programmer).
Regards
Gastón
dear;
I have f28035, but i have aproblem to set the ADC in simulinnk to read the current of the motor, i have high voltage kit !! can you hep me to solve this problem?
thanks
ahmed,
we mapped the same signals to multiple ADC pins for flexibility and so we could do dual S-H if required (notice that each current shares a A#/B# with another).