Requests


This page is for you! If you’d like more information about something I’ve posted about, or if there is a topic you think I should post about, please leave a comment and I’ll get right to it (as fast as my schedule permits it)!

I have started to list things in my bucket list (still ongoing).

For feature requests or bug reports on the McuOnEclipse project end Processor Expert components, you should use the GitHub issue tracking system:

Advertisements

768 thoughts on “Requests

  1. Erich,
    I recently discovered a bug in some PEx-generated code for USB. The bug is brought in by invoking your USB component but I believe the problem lies in the Freescale USB Stack V4.1.1 when run on a K40 processor.

    PEx generates two files: wdt_kinetis.c and wdt_kinetis.h, that implement Watchdog_Reset(). The instruction in that subroutine: (void)(WDOG_REFRESH = 0xA602, WDOG_REFRESH = 0xB480); can cause a reset if an interrupt occurs between the two writes to WDOG_REFRESH. This is exactly what you were talking about when you wrote about Critical Sections.

    Watchdog_Reset() is called from usb_dci_kinetis.c, which also appears to be a Freescale USB Stack file.

    Since this code comes from a Freescale driver that I cannot modify and the offending code is re-generated every time I run Processor Expert, what can I do to fix it?

    Thanks,
    Greg

    Like

    • Hi Greg,
      I don’t think that case is a problem, because during the call to Watchdog_Reset() the interrupts are already disabled. Watchdog_Reset() is called from the delay loop in USB_DCI_Assert_Resume() which gets called from USB_Class_Initiate_Resume() which does a DisableInterrupts-EnableInterrupts around it. So there should be no interrupts in this case. Let me know if I’m missing something?

      And you can affect the code generation. First you can disable code generation for a component (see https://mcuoneclipse.com/2012/03/23/disable-my-code-generation/). Second you can directly change the code base used for the code generation, you only need to find out where the component sources are (see https://mcuoneclipse.com/2012/06/30/cde-hacking-where-is-my-stuff-a-dissection/). In my case the USB stack sources are in C:\ProgramData\Processor Expert\PEXDRV_PE5_3\Drivers\FSL_USB_Stack. So you could directly modify the sources there if you want.

      I hope this helps,
      Erich

      Like

      • Erich,

        Your description of how wdt_kinetis is used is correct, except I still have a stylistic issue with it. For a Watchdog Reset function to be sitting alone as it is with no comments regarding interrupts, what is the guarantee that future modifications to the software won’t call it while interrupts are enabled?
        In my case, that’s exactly what I did. I saw it sitting there just waiting to be called, so I called it. Then I started getting unexpected resets…

        Thanks for pointing me to the source code those routines come from.

        Greg

        Like

      • Hi Greg,
        Yes, I 100% agree with you. The Freescale engineers seems to have lumped toghther things for the USB stack that way, unfortunately. Well, there is a newer (better?) stack available in the Kinetis SDK V2.0, but I have not adopted that one because that legacy 4.1.1 stack works very well for what I need, and I did not had the bandwidth to learn that SDK v2.0 stack. Wrapping yet another EnterCritical()-ExitCritical() in the watchdog function could have a solution, but creating nested critical sections that way is not a a good thing neither. So I’m not sure what I should do, and the same time I don’t want to invest too much time into that stack. As for the watchdog, I have used my own routines outside of that one of the USB stack.

        Like

  2. Hello, Erich!
    I have a mini sumo project using the kl46z and four HC-SR04 for detecting enemies.
    I am having troubles with the lack of counters for both the echo pins (the timer units) and the motors.
    My question is if I can use more than TPM0, TPM1 and TPM2. I know they can have multiple channels, but I do not know how to use them

    Alex.

    Like

    • Hi Surdu,
      I would not use HC-SR04 for this task: it is simply not reliable and fast enough. You can use multiple timer channels, depending how you do the measurement. If you do the measurement one after each other, used dedicated pins for triggering the measurement and dedicated pins for the input capture signal.

      Like

  3. Hi Erich
    I am trying to communicate between FRDM-K64F and JY-MCU V1.06. I read your article about a pull-up resistor on the RX line that has to be pulled up. I am using KDS and processor expert. It wont allow me to enable the pull-up. CodeWarrior does allow. Does the Bluetooth_EGBT component do it?
    Is there an example I can follow.
    Also what is the advantage of using the Shell component?
    Thanks
    Eli

    Like

  4. Hi again
    Your program FRDM-K64F_Demo does communication between FRDM-K64F and JY-MCU V1.06.
    I think the download from GitHub needs to be run with Eclipse Kepler.
    What has to be done to compile it with KDS.

    Like

    • I’m using it in several projects with KDS, but probably have not published one of these projects.
      But simply create a new Processor Expert project with KDS, and add the bluetooth component to it and configure it for the UART you are using.

      Like

  5. Hi Erich
    I am trying to create a FreeRTOS project that has 3 tasks. If I enable 1 task it works. 2 or more tasks and it does not work. What am I doing wrong.
    I uploaded the project to GitHub under the name FreeRTOS example. (I think it is there)
    As always, your help is greatly appreciated.

    Like

    • Hi Eli,
      where did you upload it on GitHub?
      Have you checked your heap size (or checked the application in the debugger). I think your heap size is too small so you run into the ‘out of memory’ FreeRTOS hook.
      Erich

      Like

  6. The project is on GitHub at EliNaiman/FreeRTOS-example
    My code does not allocate any memory.
    Once it is working, this should be an example for beginners like me.

    Like

  7. Hi Erich
    In the FreeRTOS-example that is working, I added the following lines in main.c just before going to Run_Applications();

    /* pull up Rx pin (PTC14) for Bluetooth module */
    PORT_PDD_SetPinPullSelect(PORTC_BASE_PTR, 14, PORT_PDD_PULL_UP);
    PORT_PDD_SetPinPullEnable(PORTC_BASE_PTR, 14, PORT_PDD_PULL_ENABLE);

    The system hangs. I think it is causing an interrupt to occur. How do I take care of this.
    I am using the K64F.

    Like

  8. Hi Erich
    I have a question about Bluetooth. I am using the K64F with HC-05 as master and I am communicating with an android tablet.
    If the two are not paired, I use the LINK command, I get a prompt on the tablet to enter a passkey and the two are paired and I am able to send messages back and forth.

    I then turn off the power and then turn on the power on the K64F, I would like the two to reconnect without the prompt. How do I do that?
    As always, I truly appreciate your help.
    Eli

    Like

    • The HC-05+FRDM-K64F automatically are waiting for a connection. What you have to automate is the issue of the Link on the Android. So you would have to change the Android side for this.

      Like

  9. Hi Erich,

    I am interested in the one-wire library but to use on an ESP32 platform with FreeRTOS.
    I looked at the github repository as well as on sourceforge but could not find the “normal” source code files.

    Any hints where I must look?

    Thanks

    Like

  10. Erich
    Can you give me a link to a starting point for using your PE system with the Kinetis SDK v2.2 please?

    I have to change from MQX to FreeRTOS and SDK v2.2 and wanted to use PE. I used PE a long time ago, v10 and before with CodeWarrior but was blocked because of missing BSP’s for parts I was using and so on. So we switched from PE because MQX was limited with PE.

    And now I find the SDK documentation very difficult to follow with no explanation of why a particular design is being done and just basically incorrect (function calls that do not exist, incorrect numbers of parameters and so on in the example code). So I wanted to go back to PE but I am not sure how to start. I have followed your work for sometime now and always appreciated your clear explanations. I noted that you at one point did not have a way to integrate PE with the SDK v2.2 and that FSL/NXP had stopped the integration with PE after SDK v1.3 but am hoping now that you have found a way through the maze, or I may have misunderstood your recent post. The end result is I am trying to start over again by not sure how to begin. Could you point me to a project that you have done that uses a USB FAT system and or an i2c driver please? There are a lot of projects and ways to fail, so i am looking for a starting point if possible. Thanks.

    Robert

    Like

  11. Hi Eric

    A second question please… I over looked. What would be the starting point to get the IDE working? I have KDS installed but also Atollic and would like to use Atollic if possible. Is there a guide to follow to install all the bits and pieces? It used to be a lot of loading of modules into eclipse and I am not sure I remember the steps. I tried to use KDS V3.2 recently with another group and we could not even read the registers of the core peripherals. We tried various google suggestions but failed so we used IAR instead. But I realize eclipse is the key requirement for starting with PE and following your teachings so that is where I want to begin. Thanks again.

    Robert

    Like

  12. Hi Erich!
    I’ve beeing reading your stuff and it’s wonderful what you’ve done here…
    I’m new in this story of embedded system… but I’m enjoying about it in your website.
    I want to use event counter in KL25z, but I always fall into a Cpu_ISR, It looks like int cannot convert some value and stop there.
    Can you please publish a post about event counter. to count external event?

    Thank you!

    Like

  13. Hi Erich,
    I am doing my Master thesis at Lund University, Sweden. I need to design a debugger for a customized Processor. I know what all the things i need to do at the hardware part. But coming to software part i came to know that i need to use GDB and OpenOCD. I am unable to find the design information about these debuggers and what all changes i need to do in them so that i can debug my processor. If you can help me to know about these debuggers in detail will be helpful for my thesis.

    Thank you!
    Dinesh

    Like

      • Hi Erich,
        Thank you so much for the reply.

        I can explain you my thesis in detail.
        I am doing my thesis at a company. They have a customized Processor built on their own. They want me to develop a debugger for that processor. I have implemented Jtag to AHB which connects to the processor. This is on the Hardware part.

        I am using Bus blaster from Dangerous Prototypes to debug this Processor and this Bus blaster uses GDB,OpenOCD and Telnet. In my research i understood that this OpenOCD is compatible to only MIPS and ARM Processor’s. Now i need to make their customized processor also compatible to this OpenOCD. I am stuck at this point. I don’t know what all changes i need to do in these debuggers so that these are compatible with that processor. Most of the sites are explaining oh how to use but not how to add a New target to these debuggers.

        My questions is Do you know how to add a New Target to GDB and OpenOCD debuggers?

        Like

      • I’m affraid that I don’t know that level of details. In any case, as long as your processor uses the standard JTAG access method, you don’t have to change OpenOCD itself. All what you have to do is to add the flash programming and low level register access to it. On the GDB side you should not have to do much (if anything), as this should be handled by the plugin. However, as you have a custom processor with a different instruction sets, you would have to add that to GDB, but I would have to dig into details for this first, but I doubt I won’t be able to do this in the near term.

        Liked by 1 person

  14. Dinesh, how much work you have to do depends on your definition of “custom processor”.
    If their processor is a custom part built around a stock ARM Core, then its not really custom, only the peripherals are.
    But if the core itself is custom (running its own instruction set) then you have a big job.
    I suspect its the former.
    In which case you need to make sure that the registers in the processor that identify the specific ARM Core are presenting that data correctly. Then the debugger should adapt. You may have to select the core when configuring GDB as well.
    That’s my 2 cents.

    Liked by 1 person

  15. Hi Erich,

    I am trying to port code written for stm32f10 MCU in the IAR embedded workbench to codeblocks that has GCC. Could you help me with the same? I do not seem to find a free plugin for the same.

    Thanks,
    Aakash

    Like

  16. Hi Erich,
    I have a K64F with an HC-05 module communicating to a tablet via Bluetooth. The HC-05 is a MASTER and the tablet is a SLAVE. (working great)

    If the slave shuts down, how can I detect that on the K64F when the HC-05 is in automatic connection work mode.

    Thanks
    Eli

    Like

  17. Hi again
    I found the solution. The STATE pin on the HC-05 goes LOW when the slave disconnects.

    I now have to figure out what to do when the slave starts up again.

    Thanks
    Eli

    Like

  18. hi erich, im making a car with navegation per compass and i would know ,how set up the component MAG3110 is a magnetometer and i need the information of cardinal point for be guided per bluetooth for example i send that the car go 5 meter south , 2 noth etc

    Like

    • My feedback is that this will be very hard to accomplish unless you have an absolute position sensor. The compass alone will not help you to reach that goal as it will not be accurate enough.

      Like

      • Yes, but I know it will not be so accurate because it is for practical purposes only demonstration or with you recommend me to do? There is another component that I can use besides the mag3110 but I would still like to know if you can help me to configure this component.

        Like

      • But the compass I only need it to indicate the points and with the programming, with the variations that the compass can make in those points as a starting point to say so.

        Like

      • ok im read the information but can you say me ?whats device or component or sensor can i use for this project i was thinking in giroscope but is there any way to do something similar.

        Like

      • As I don’t know your requirements, I only can give a very generic advice. If you want to move on the ground something to an absolute position, you need an absolute position sensor. Accerlerometer and Gyros will give you only relative information. Due the nature of intergration, you are inherently accumulating the errors: the more error and the more time, the bigger the delta. You can reduce the error with better sensors, sensor fusion and with using an absolute reference point.

        Like

      • A GPS module and antennae is well under US$10 in modest volume. (like 1k)
        If you use a board-mount antennae, then balancing the load, or signal matching, can take a few weeks (we’ve done that). But if you just run to an SMA-A connector (and feed your 3.3v supply through a ferrite to the antennae signal to power an “Active Antennae”) then its easy.

        We use Venus modules from SkyTraq in Taiwan. It has the receiver, LNA, crystal, and passives all in one device that looks like a plain chip. There is a breakout board with the module mounted available for $50- online @ Q=1 from … SparkFun, I think (googling) here it is:
        https://www.sparkfun.com/products/11058

        connect the antennae, apply power, and seconds later the Serial TX pin will start pumping out an NMEA message @ 9600 baud exactly once-per-second. You don’t have to do a thing.
        Message has lattitude, longitude, altitude, and ground-speed IIRC.
        And its all plain ASCII text, readable, with a CR at the end of each line.
        As my buddies from Hong Kong would say: “Piece of cake, man!”

        Like

      • yes, But what would be that sensor to achieve that absolute position would be the accelerometer or the gisroscope?

        Like

      • Excuse me, I better have to ask what sensor I can use to achieve the absolute position or no solution

        Like

      • if you have minimal or no slippage, use an high resolution quadrature encoder for the wheels. In addition to that, use an absolute distance sensor to a known reference point. Outdoor, you could use a GNSS or referential GNSS system. You could use a laser scanner or ToF sensors. It really depends on you requirements: how accurate, for how long, etc.

        Like

      • maybe for 10 or 20 minute but is there a form for save the moves in the area for example the first move or that you propose

        Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s