Having access to a Real-time Operating System (RTOS) provides embedded system developers many advantages such as: Breaking the software up into semi-independent programs Deterministic scheduling Providing pre-emption (highest available priority threads run first) Providing a common tool set to synchronization activities within the software In the bare-metal universe, developers must fight with their system to adjust timing with every code change and manage the system timing all by themselves. Using an RTOS such as ThreadX, which is included in the Renesas Synergy™ Platform toolchain with no additional costs, cannot only simplify embedded software development but provide developers with the tools necessary to ensure their system performs as expected. In this series, Transitioning to ThreadX, we will explore RTOS concepts and demonstrate how they can be immediately applied to the Synergy Platform to help developers decrease system complexity. The first concept a developer needs to grasp about RTOSes is that the software can now be broken up into individual tasks or threads. A thread is a semi-independent program segment that performs a specific function within the application. For our purposes, threads and tasks are synonyms but refer to the ThreadX documentation for a detailed explanation on the minor differences. Threads give an embedded system the illusion that they are running concurrently. The RTOS kernel manages the threads such that the highest priority thread that is ready to run can use the microcontrollers CPU to execute while the remaining threads are suspended waiting for their turn on the CPU. Each thread has a thread control block, TCB, which contains information about the thread such as its priority, a pointer to the function that should be executed when the thread is ready to execute, a string name and many other elements including a pointer to the threads stack space. Yes, you read that correctly! Every thread has its own, personal and individual stack space that is separate from every other thread. It is up to the developer to determine the appropriate size for the stack and size it accordingly. Before we concern ourselves about stack sizes, we should first examine how we can go about creating a thread in the first place. For a developer that is not using the Synergy Platform, creating a thread requires calling the tx_thread_create API and passing the necessary initialization parameters into the function. This is not necessarily a big deal but as can be seen below, providing the right information to the create API call can require some time to pull together the correct parameters and is error prone: tx_thread_create (&blinky_thread, // pointer to thread (CHAR *) " Blinky Thread", // pointer to String name blinky_thread_func, // Thread entry function (ULONG) NULL, // Entry parameter pointer &blinky_thread_stack, // Stack start pointer 1024, // Stack size 1, // Priority 1, // Preemption Threshold 1, // Time Slice TX_AUTO_START); // Autostart When using the Synergy Configurator, developers need to simply visit the Threads tab and then within the Threads section, select the green plus symbol as highlighted below in red: Pressing the add thread button will create a new thread which contains the default settings. Developers can view the thread properties and adjust the name, stack size, priority and even whether the thread is started immediately or enabled by the application code. The parameters that are accessible to the developer can be seen below: Once a developer updates these properties and presses the Generate Project Content button, the development environment will generate initialization code and the thread. The initialization code and the thread create function can be found under the /src/synergy_gen/ folder in the .h and .c files with the thread name. These files are automatically generated and cannot be changed by the developer. However, the thread code is located under the /src/ folder and is has the thread name appended with _entry. For example, new_thread0 would have a new_thread0_entry.c module that contains a default new_thread0_entry function just waiting for a developer to add their own custom code to. The default code that is generated would be: Notice that the thread has an infinite while loop included. Since every thread is a semi-independent program, it looks just like a normal bare-metal main function that would include an infinite loop to keep the application code running. A thread can be created that does not include this infinite loop but the thread would run once and then be marked as completed and never execute again without calling a kernel function to restart the thread. A best practice is to never allow a thread to complete on its own but to instead use a kernel feature to halt or remove it if necessary. ThreadX handles running a thread to completion without issues but other RTOSes will define such an event as an undefined feature and can cause a system failure. FreeRTOS for example will fail silently and stop executing code if a task runs to completion, leaving the developer chasing his tail to figure out why their application code stopped executing. ThreadX thankfully continues to execute as if nothing had happened other than a thread has completed. There is so much more to discuss about ThreadX and how to get the most out of it when using the Synergy Platform but hopefully this introduction has wetted your whistle for now. Until next time, Live long and profit! Professor_IoT Hot Tip of the Week Using multiple threads can be especially effective in complex applications that have several tasks that need to execute in parallel. For example, a web camera needs to manage real time video, an HTTP connection, JPEG conversion and control or diagnostic connectivity, perhaps over USB. This would be a very tall order for a single loop implementation. Check out the following application project that illustrates and demonstrates how multiple threads can be used to make such complex projects manageable. https://www.renesas.com/en-us/doc/products/renesas-synergy/apn/r12an0046eu0120-synergy-pdc-camera.pdf
↧
Blog Post: Transitioning to ThreadX: Creating Threads
↧
Forum Post: RE: Why the new look?
Hi Josh, I have reported to you "the story stream does not show full activities" problem. I am wondering that when this problem will be solved? Do you have an estimated date? Thanks. Jennifer.
↧
↧
Forum Post: Microcontroller selection
Hi, I am looking for a micrcontroller that meets the following specifications: Programming language: C, or Python, or other programmable language. It would be better if the microcontroller can run Matlab mat file and/or compatible with Matlab. Computation type: Floating point, or other recommended type. Number of inputs into micro-controller: At least 1 input for CAN Sampling time: 10ms Connection with sensors: CAN class C (TJA1040) Connection with computer: USB, or other Memory size: 512MB, or more. Please let me know if any of your products meet this requirement. Thanks. Bharat
↧
Forum Post: Required 78K family
Require UPD78F0891GK(A)-GAK-AX 80-pin plastic LQFP (Fine pitch) (12x12) UPD78F0532AGC(A)-GAL-AX 64- pin plastic LQFP (14×14)
↧
Forum Post: ..................URGENT.................
For the maintenance work i requirement of this micro-controller for same like this µPD78F0891GK(A)-GAK-AX 80-pin plastic LQFP (Fine pitch) (12x12) 78F0532AGC(A)-GAL-AX 64- pin plastic LQFP (14×14)
↧
↧
Forum Post: RL78 Self Programming over UART
Hi , I'm using RL78G13 and e2studio with KPIT compiler. How can I use self programming property of mcu, is it possible to use UART2 for this work? Also how should I send reprogramming data, are there any example for steps ? Best Regards
↧
Forum Post: RE: SFMA source code regarding
Hai Scott Winder , Thanks for your reply. I am new to this community could you please help me how can contact them.actually we are using RH850D1M series board . Regards Sachu
↧
Forum Post: Hitachi MCU F2117LP
Any one has any idea or any device that Can program Hitachi microcontroller F2117LP please help
↧
Forum Post: RE: Hitachi MCU F2117LP
Please use FDT software for programming. You can download it here . You can use FDT to prgram H8S/2217 via E8a or directly via UART connection from PC if your hardware is prepared for this. The list of supported devices is here .
↧
↧
Forum Post: RE: SFMA source code regarding
Hello Sachu, if you have the RH850D1M board you should have contact to Renesas sales people. Please ask them to make contact to their FAE.
↧
Forum Post: Power failure with yRotate-it-rx111, E2 Lite and e2 Studio
Hi all, i've bought new yRotate-it-rx111 board, rev 2.0, E2 Lite programmer and installed e2 Studio 5.2 on Windows 7 both, in a Virtual Machine on a Kubuntu 16.04 host and as native OS. The hardware parameters are the following: the E2 Lite programmer is connected to the yRotate-it using 14 pin J5 yRotate-it: green LEDs of the switching regulators are lighting yRotate-it: JP11 to JP16 are open yRotate-it: Motor is not connected yRotate-it: Power is 24 V, current consumtion is 30 mA E2 Lite-LED: ACT lights green E2 Lite-LED: VCC lights red E2 Lite-LED: RESET lights yellow Turning off yRotate power, all LEDs with exception of the E2Lite ACT turns off Project parameters are: Installed e2 Studio for RX only Toolchain Version: 4.8.0.201603 Debug Hardware: E2 Lite (RX) Little Endian Target: R5F51115AxFL Hardware Debug select box checked Debug using Simulator select box checked After compiling the "new sample project" from e2 Studio, I get always the same error message by running a "Hardware debug" debug session: --- start log --- GDBServer for Renesas targets. Version 5.2.0.019 (Sep 15 2016 13:41:01) Starting server with the following options: Raw options : C:\Renesas\e2_studio\eclipse\../DebugComp/e2-server-gdb -g E2LITE -l 0 -t R5F51115 -p 61234 -d 61236 -uClockSrcHoco= 0 -uInputClock= 12.0000 -uAllowClockSourceInternal= 1 -uUseFine= 1 -uFineBaudRate= 1.50 -w 1 -z 0 -uRegisterSetting= 0 -uModePin= 0 -uDebugMode= 0 -uExecuteProgram= 0 -uIdCode= FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -n 0 -uWorkRamAddress= 1000 -uProgReWriteIRom= 0 -uProgReWriteDFlash= 0 -uhookWorkRamAddr= 0x1000 -uhookWorkRamSize= 0x230 Connecting to E2LITE, RX Target GDBServer endian : little Target power : on Starting target connection FFW Call Error for CFFWInterface::FFWE20Cmd_GetEINF:USB bus power volage is low. Firmware up to date at version '1.02.00.000' PowerSuppy() Failed RxTargetDevice::startConnection() Rx_Init_E1_E20() Failed GDB action 'connect to target', has failed with error report, Failed to set external power mode force_kill_gdb() Disconnected from the Target Debugger. --- end log --- When I try to start a debug session without powered yRotate-it, I get an error message "Could not initialise E1/E20 device". Do you have an Idea, whats going wrong? Thank you very much for your help, Christoph
↧
Forum Post: RE: USB host controller stopped by windows, Code 43
Kamil, The screenshot you have posted is from SSP 1.2.0 b1, whereas the original poster is using SSP 1.1.3, so to have the same effect they have to modify the file src/sf_el_ux_comms_port.h file in their project. lrumanroe, I have noticed using SSP 1.1.3, that there is no error reported in the configurator if you don't enable the interrupt for the low level USB driver (g_sf_el_ux USBX port HS and FS on sf_el_ux), is this enabled in the project using the S124 user board?
↧
Hi, is there any samples or articles on External Bus, to read/write as 16-bit wide parallel? I intend to connect an old subsystem used with SH4A 7780 via MPX burst mode. I saw one on external QSPI I/F, though. in Renesas Synergy Platform
Hi, is there any samples or articles on External Bus, to read/write as 16-bit wide parallel? I intend to connect an old subsystem used with SH4A 7780 via MPX burst mode. I saw one on external QSPI I/F, though. in Renesas Synergy Platform
↧
↧
Forum Post: code is not downloading in a board
Hi all, I am working on rl78i1c, using tool E1. I am trying to download my code in the board but it is showing error (Incorrect ID Code.(C0602202). How to solve this problem??
↧
Forum Post: S7G2-DK Touch
Hi, I have a S7G2-DK that is being used for development. The included 4.3" resistive touch has been tested and verified. We then based a few GUI designs off of the schematics. A 5.7", 6.5" and 7" design were all done. Testing has shown that the GLCD and GUIX works. The problem lies with the touch screen. All designs use the same included sx8654 driver in SSP 1.3.0. The 4.3" and 5.7" resistive touch work as expected. Then I go to the higher resolution and bigger touch screens and the response time is not good. The specs for the touch screen are basically the same, I have tried changing the Update Hz in the Configuration and that does not appear to help. On the higher resolution, bigger screens, using the fat part of the finger almost gets no response while a stylus gets a quick response. I am trying to understand why there is a difference in touch response and what I options I have. Thank you, Draper
↧
Forum Post: RE: code is not downloading in a board
Which tool do you use? The ID code is most probably the debug ID. This is a means that you cannot use the debugger to connect to a programmed device. It will help if you erase the device before you try to connect.
↧
Forum Post: RE: S7G2-DK Touch
Hello Draper, I can't see why larger touch overlay would slow the response down - after all it's just a pair of ADC signals going into Samtech IC. When using DK-S7, the touch is connected to the SCI peripheral. You'll need to make sure that the pins for it are configured as n-channel open drain. I also highly recommend switching to the fast-mode for I2C transmission. There's an unnecessary delay of 10-20ms hard-coded in the driver (which should be fixed in the near future), however you should see the same response regardless of the screen size. Regards
↧
↧
Forum Post: RE: RL78 Self Programming over UART
See the sample code and application note at www.renesas.com/.../D3011880.html Note that the code is written for the CS+ compiler and development environment, and will have to be adapted to work with GCC.
↧
Forum Post: RE: Networking on the DK-S7G2
I'm running in to an issue when trying to connect to an echo server using the NetX client API. I'm trying to connect using the following: nx_system_initialize (); status = nx_packet_pool_create(&pool_0, (CHAR* )"NetX Main Packet Pool", (1536 + 32), packet_pool_area, sizeof(packet_pool_area)); status = nx_ip_create(&ip_0, (CHAR* )"NetX IP Instance 0", SERVER_IP_ADDRESS, 0xFFFFFF00UL, &pool_0, nx_ether_driver_eth1, &NETX_TP, 2048, 1); status = nx_ip_fragment_enable (&ip_0); status = nx_arp_enable (&ip_0, (void *) &NETX_ARP, 1024); status = nx_icmp_enable (&ip_0); status = nx_tcp_enable (&ip_0); status = nx_tcp_socket_create(&ip_0, &clientSocket, "Echo client socket", NX_IP_NORMAL, NX_FRAGMENT_OKAY, NX_IP_TIME_TO_LIVE, 100, NX_NULL, NX_NULL); status = nx_tcp_client_socket_bind (&clientSocket, NX_ANY_PORT, NX_WAIT_FOREVER); status = nx_tcp_client_socket_connect (&clientSocket, IP_ADDRESS(192, 168, 2, 15), 8888, NX_WAIT_FOREVER); Everything seems to go OK until the socket_connect call. I see the following in a packet capture (2.140 is the dev board, and 2.15 is the echo server IP). 121 9.645588 2e:09:0a:00:76:c8 Broadcast ARP 60 Who has 192.168.2.15? Tell 192.168.2.240 122 9.645615 WistronI_2c:41:c8 2e:09:0a:00:76:c8 ARP 42 192.168.2.15 is at 3c:97:0e:2c:41:c8 123 9.645774 192.168.2.240 192.168.2.15 TCP 62 30000 ? 8888 [SYN] Seq=0 Win=100 Len=0 MSS=1460 124 9.645831 192.168.2.15 192.168.2.240 TCP 54 8888 ? 30000 [ACK] Seq=1 Ack=1 Win=64240 Len=0 142 10.645621 192.168.2.240 192.168.2.15 TCP 62 [TCP Spurious Retransmission] 30000 ? 8888 [SYN] Seq=0 Win=100 Len=0 MSS=1460 143 10.645705 192.168.2.15 192.168.2.240 TCP 54 [TCP Dup ACK 124#1] 8888 ? 30000 [ACK] Seq=1 Ack=1 Win=64240 Len=0 162 11.645562 192.168.2.240 192.168.2.15 TCP 62 [TCP Spurious Retransmission] 30000 ? 8888 [SYN] Seq=0 Win=100 Len=0 MSS=1460 163 11.645623 192.168.2.15 192.168.2.240 TCP 54 [TCP Dup ACK 124#2] 8888 ? 30000 [ACK] Seq=1 Ack=1 Win=64240 Len=0 ... I'm not seeing a SYN-ACK from the Synergy board, so I'm guessing that some part of the network stack isn't getting that packet. ARP resolution works because I can ping fine using the same setup code. I'm comparing the project configuration between my project and several examples, but I'm not certain which differences are pertinant. I can't seem to find examples of the click_socket_bind and client_socket_connect in use, so I may be missing something obvious.
↧
Forum Post: RE: Enable NetX Socket ADDR_REUSE Flag
Any update? Did you find the root cause? Thanks and Br
↧