<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://socialledge.com/sjsu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sree</id>
		<title>Embedded Systems Learning Academy - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://socialledge.com/sjsu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sree"/>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php/Special:Contributions/Sree"/>
		<updated>2026-05-09T21:45:10Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_FreeRTOS&amp;diff=51341</id>
		<title>Embedded System Tutorial FreeRTOS</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_FreeRTOS&amp;diff=51341"/>
				<updated>2019-01-25T20:11:27Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Socialledge is moving to two portals.  &lt;br /&gt;
*  The Wiki will remain here for general references about the SJ-One board, and to document student reports.&lt;br /&gt;
*  The bookstack will now be used for SJSU assignments&lt;br /&gt;
&lt;br /&gt;
[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/freertos-tasks This article has been moved here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
The objective of this assignment is to show you how to create a FreeRTOS task a few different ways.  The [[FreeRTOS Tutorial]] is definitely a must read before going through this lesson.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS &amp;quot;Hello World&amp;quot; Task ==&lt;br /&gt;
A task just needs memory for its stack and an infinite loop.  To prevent &amp;quot;hogging&amp;quot; the CPU, you should use a delay such that the CPU can be allocated to other tasks.  Here is the simplest FreeRTOS task:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void hello_world_task(void* p)&lt;br /&gt;
{&lt;br /&gt;
    while(1) {&lt;br /&gt;
        puts(&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        vTaskDelay(1000);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    xTaskCreate(hello_world_task, (signed char*)&amp;quot;task_name&amp;quot;, STACK_BYTES(2048), 0, 1, 0);&lt;br /&gt;
    vTaskStartScheduler();&lt;br /&gt;
&lt;br /&gt;
    return -1;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== C++ based FreeRTOS task ==&lt;br /&gt;
As a project gets more complex, it becomes difficult to manage initialization and share queue or semaphore handles.  This was the motivation to create a C++ based FreeRTOS task.&lt;br /&gt;
&lt;br /&gt;
=== Share &amp;quot;Objects&amp;quot; ===&lt;br /&gt;
A task can &amp;quot;share&amp;quot; its pointers, handles, or &amp;quot;objects&amp;quot; with another task by name. This way, we don't have to worry about declaring handles into a common header file, hence we do not plague the global namespace :)  See the next examples on how a task can share a handle with another task by an intuitive string name.&lt;br /&gt;
&lt;br /&gt;
=== C++ Task ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/// IDs used for getSharedObject() and addSharedObject()&lt;br /&gt;
typedef enum {&lt;br /&gt;
   shared_SensorQueueId,&lt;br /&gt;
} sharedHandleId_t;&lt;br /&gt;
&lt;br /&gt;
/// Orientation type enumeration&lt;br /&gt;
typedef enum {&lt;br /&gt;
    invalid,&lt;br /&gt;
    left,&lt;br /&gt;
    right,&lt;br /&gt;
} orientation_t;&lt;br /&gt;
&lt;br /&gt;
class orient_compute : public scheduler_task&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
        orient_compute(uint8_t priority) : scheduler_task(&amp;quot;compute&amp;quot;, 2048, priority)&lt;br /&gt;
        {&lt;br /&gt;
            /* We save the queue handle by using addSharedObject() */&lt;br /&gt;
            QueueHandle_t my_queue = xQueueCreate(1, sizeof(orientation_t));&lt;br /&gt;
            addSharedObject(shared_SensorQueueId, my_queue);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        bool run(void *p)&lt;br /&gt;
        {&lt;br /&gt;
            /* Compute orientation here, and send it to the queue once a second */&lt;br /&gt;
            orientation_t orientation = invalid;&lt;br /&gt;
            xQueueSend(getSharedObject(shared_SensorQueueId), &amp;amp;orientation, portMAX_DELAY);&lt;br /&gt;
&lt;br /&gt;
            vTaskDelay(1000);&lt;br /&gt;
            return true;&lt;br /&gt;
        }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class orient_process : public scheduler_task&lt;br /&gt;
{&lt;br /&gt;
    public:&lt;br /&gt;
        orient_process (uint8_t priority) : scheduler_task(&amp;quot;process&amp;quot;, 2048, priority)&lt;br /&gt;
        {&lt;br /&gt;
            /* Nothing to init */&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        bool run(void *p)&lt;br /&gt;
        {&lt;br /&gt;
            /* We first get the queue handle the other task added using addSharedObject() */&lt;br /&gt;
            orientation_t orientation = invalid;&lt;br /&gt;
            QueueHandle_t qid = getSharedObject(shared_SensorQueueId);&lt;br /&gt;
&lt;br /&gt;
            /* Sleep the task forever until an item is available in the queue */&lt;br /&gt;
            if (xQueueReceive(qid, &amp;amp;orientation, portMAX_DELAY))&lt;br /&gt;
            {&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            return true;&lt;br /&gt;
        }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that a better design is to minimize the use of &amp;lt;b&amp;gt;&amp;lt;code&amp;gt;getSharedObject()&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;.  So it is recommended that the creator of the handle add the shared object in its &amp;lt;b&amp;gt;&amp;lt;code&amp;gt;init()&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt;, and other tasks can store the handle in their &amp;lt;b&amp;gt;&amp;lt;code&amp;gt;taskEntry()&amp;lt;/code&amp;gt;&amp;lt;/b&amp;gt; function.&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Add the task in main() ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    scheduler_add_task(new orient_compute(PRIORITY_LOW));&lt;br /&gt;
    scheduler_add_task(new orient_process(PRIORITY_LOW));&lt;br /&gt;
    scheduler_start();&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Assignment ==&lt;br /&gt;
This assignment is based on SJ-One board, but you can alter the requirement to fit your own hardware.&lt;br /&gt;
#  Create a task (task1) that computes the orientation of the board.&lt;br /&gt;
#:   You can use the acceleration sensor to figure out the orientation of the board&lt;br /&gt;
#:   Send the orientation enumeration, such as &amp;quot;up&amp;quot;, &amp;quot;down&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot; to a queue every 1 second&lt;br /&gt;
#  Create another task (task2) that waits on the queued item&lt;br /&gt;
#:   If the orientation is left or right, light up the LEDs (otherwise turn them off)&lt;br /&gt;
#  Note down the observations by doing the following:&lt;br /&gt;
#:   Print a message before and after sending the orientation to the queue&lt;br /&gt;
#:   Print a message after the second task receives an item from the queue&lt;br /&gt;
#:   Use the same priority for both tasks, and note down the order of the print-outs&lt;br /&gt;
#:   Use higher priority for the receiving task, and note down the order of the print-outs.&lt;br /&gt;
#  Create a terminal command: &amp;quot;orientation on&amp;quot; and &amp;quot;orientation off&amp;quot;&lt;br /&gt;
#:   If orientation is commanded on, resume the task1, otherwise suspend it&lt;br /&gt;
#:   See code below on hints of how this command can get control of another task.&lt;br /&gt;
#  Answer the following questions:&lt;br /&gt;
#:   What if you use ZERO block time while sending an item to the queue, will that make any difference?&lt;br /&gt;
#:   What is the purpose of the block time during xQueueReceive() ?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// At the terminal tasks taskEntry() function :&lt;br /&gt;
bool terminalTask::taskEntry()&lt;br /&gt;
{&lt;br /&gt;
    cp.addHandler(orientationCmd,  &amp;quot;orientation&amp;quot;, &amp;quot;Two options: 'orientation on' or 'orientation off'&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Somewhere else:&lt;br /&gt;
CMD_HANDLER_FUNC(orientationCmd)&lt;br /&gt;
{&lt;br /&gt;
    // Our parameter was the orientation tasks' pointer, but you may want to check for NULL pointer first.&lt;br /&gt;
    scheduler_task *compute = scheduler_task::getTaskPtrByName(&amp;quot;compute&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // You can use FreeRTOS API or the wrapper resume() or suspend() methods&lt;br /&gt;
    if (cmdParams == &amp;quot;on&amp;quot;) {&lt;br /&gt;
        vTaskResume(compute-&amp;gt;getTaskHandle());  // Can also use: compute-&amp;gt;resume();&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
        vTaskSuspend(compute-&amp;gt;getTaskHandle()); // Can also use: compute-&amp;gt;suspend();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_File_I/O&amp;diff=51340</id>
		<title>Embedded System Tutorial File I/O</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_File_I/O&amp;diff=51340"/>
				<updated>2019-01-25T20:10:02Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Socialledge is moving to two portals.  &lt;br /&gt;
*  The Wiki will remain here for general references about the SJ-One board, and to document student reports.&lt;br /&gt;
*  The bookstack will now be used for SJSU assignments&lt;br /&gt;
&lt;br /&gt;
[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/chapter/lesson-watch-dogs This article has been moved here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
In this project, we will attempt to &amp;quot;combine&amp;quot; all the FreeRTOS knowledge into a single assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After completing the assignment, you will get a sense of how the CPU is utilized, and how to use a new FreeRTOS event group API.  All together, you should achieve a better sense of designing your tasks and using the File I/O for debugging purposes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
Please follow the steps precisely in order to complete the objectives of the assignment.  If you use the C++ FreeRTOS framework, it should make the assignment significantly easy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#  Create a '''&amp;lt;code&amp;gt;producer task&amp;lt;/code&amp;gt;''' that takes 1 light sensor value every 1ms.&lt;br /&gt;
#*  After collecting 100 samples (after 100ms), compute the average.&lt;br /&gt;
#*  Write average value every 100ms (avg. of 100 samples) to the '''&amp;lt;code&amp;gt;sensor queue&amp;lt;/code&amp;gt;'''.&lt;br /&gt;
#*  Use medium priority for this task&lt;br /&gt;
#  Create a '''&amp;lt;code&amp;gt;consumer task&amp;lt;/code&amp;gt;''' that pulls the data off the '''&amp;lt;code&amp;gt;sensor queue&amp;lt;/code&amp;gt;''' &lt;br /&gt;
#*  Use infinite timeout value during queue receive API&lt;br /&gt;
#*  Open a file (sensor.txt), and append the data to an output file on the SD card.&lt;br /&gt;
#*  Save the data in this format: '''&amp;lt;code&amp;gt;printf(&amp;quot;%i, %i\n&amp;quot;, time, light)&amp;quot;&amp;lt;/code&amp;gt;'''&lt;br /&gt;
#*  Note that if you write and close a file every 100ms, it may be very inefficient, so try to come up with a better method such that the file is only written once a second or so...&lt;br /&gt;
#*  Use medium priority for this task&lt;br /&gt;
#  At the end of the loop of each task, set a bit using FreeRTOS event group API.&lt;br /&gt;
#*  At the end of each loop of the tasks, set a bit using the '''&amp;lt;code&amp;gt;xEventGroupSetBits()&amp;lt;/code&amp;gt;'''&lt;br /&gt;
#*  Task 1 should set bit1, Task 2 should set bit2 etc.&lt;br /&gt;
#  Create a '''&amp;lt;code&amp;gt;watchdog task&amp;lt;/code&amp;gt;''' that monitors the operation of the two tasks.&lt;br /&gt;
#*  Use high priority for this task.&lt;br /&gt;
#*  Use a timeout of 1 second, and wait for all the bits to set.  If there are two tasks, wait for bit1, and bit2 etc.&lt;br /&gt;
#*  If you fail to detect the bits are set, that means that the other tasks did not reach the end of the loop.&lt;br /&gt;
#*  In the event of failed to detect the bits, append a file (stuck.txt) with the information about which task may be &amp;quot;stuck&amp;quot;&lt;br /&gt;
#*  Open the file, append the data, and close the (stuck.txt) file to flush out the data immediately.&lt;br /&gt;
#*  Extra Credit: Every sixty seconds, save the CPU usage info to a file named &amp;quot;cpu.txt&amp;quot;.  See terminal command &amp;quot;infoHandler&amp;quot; for reference.  Open the file, write the file, and close it immediately so the data is immediately flushed.&lt;br /&gt;
#  Create a terminal command to &amp;quot;suspend&amp;quot; and &amp;quot;resume&amp;quot; a task by name.&lt;br /&gt;
#*  &amp;quot;task suspend task1&amp;quot; should suspend a task named &amp;quot;task1&amp;quot;&lt;br /&gt;
#*  &amp;quot;task resume task2&amp;quot; should suspend a task named &amp;quot;task2&amp;quot;&lt;br /&gt;
#  Run the system, and under normal operation, you will see a file being saved with sensor data values.&lt;br /&gt;
#*  Plot the file data in Excel to demonstrate.&lt;br /&gt;
#  Suspend the producer task.  The watchdog task should display a message and save relevant info to the SD card.&lt;br /&gt;
#  Let the system run for a while, and note down the CPU usage in your text file.&lt;br /&gt;
&lt;br /&gt;
What you created is a &amp;quot;software watchdog&amp;quot;.  This means that in an event when a loop is stuck, or a task is frozen, you can save relevant information such that you can debug at a later time.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Embedded_System_I2C_Tutorial&amp;diff=51339</id>
		<title>Embedded System I2C Tutorial</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Embedded_System_I2C_Tutorial&amp;diff=51339"/>
				<updated>2019-01-25T20:06:48Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Socialledge is moving to two portals.  &lt;br /&gt;
*  The Wiki will remain here for general references about the SJ-One board, and to document student reports.&lt;br /&gt;
*  The bookstack will now be used for SJSU assignments&lt;br /&gt;
&lt;br /&gt;
[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/chapter/lesson-i2c This article has been moved here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Theory of Operation ==&lt;br /&gt;
I2C is prounced &amp;quot;eye-squared see&amp;quot;.  It is also known as &amp;quot;TWI&amp;quot; because of the intial patent issues of this BUS.  This is a popular, low throughput (100-1000Khz), half-duplix BUS that only uses two wires regardless of how many devices are on this BUS.  Many sensors use this BUS because of its ease of adding to a system.&lt;br /&gt;
&lt;br /&gt;
=== Open-Collector BUS ===&lt;br /&gt;
I2C is an open-collector BUS, which means that no device shall have the capability of internally connecting either SDA or SCL wires to power source.  The communication wires are instead connected to the power source through a &amp;quot;pull-up&amp;quot; resistor.  When a device wants to communicate, it simply lets go of the wire for it to go back to logical &amp;quot;high&amp;quot; or &amp;quot;1&amp;quot; or it can connect it to ground to indicate logical &amp;quot;0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Pull-up resistor ===&lt;br /&gt;
Using a smaller pull-up can acheiver higher speeds, but then each device must have the capability of sinking that much more current.  For example, with a 5v BUS, and 1K pull-up, each device must be able to sink 5mA.&lt;br /&gt;
&lt;br /&gt;
[http://www.falstad.com/circuit/#%24+1+5.0E-6+3.3115451958692312+28+5.0+50%0Ac+192+176+192+240+0+1.0E-7+4.950495049504418%0Aw+192+176+256+176+0%0Ag+192+304+192+320+0%0As+112+176+112+256+0+1+false%0Ag+112+256+112+272+0%0Aw+192+176+112+176+0%0Ar+192+176+192+80+0+10000.0%0AR+192+80+192+32+0+0+40.0+5.0+0.0+0.0+0.5%0Ap+112+176+64+176+0%0Aw+256+176+320+176+0%0Ag+320+304+320+320+0%0Ar+192+240+192+304+0+100.0%0Ac+272+176+272+240+0+1.0E-7+-0.0%0Ar+272+240+272+304+0+100.0%0Ag+272+304+272+320+0%0Ar+320+304+320+176+0+1000000.0%0Ax+3+93+159+99+0+24+I2C+Simulation%0Ax+2+116+132+120+0+14+Switch+Shows+an+I2C%0Ax+2+142+119+146+0+14+grounding+a+signal%0Ao+8+64+0+34+5.0+9.765625E-5+0+-1%0A I2C Circuit Simulation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Protocol Information ==&lt;br /&gt;
I2C was designed to be able to read and write memory on a slave device.  The protocol may be complicated, but a typical &amp;quot;transaction&amp;quot; involving read or write of a register on a slave device is simple granted a &amp;quot;sunny-day scenario&amp;quot; in which no errors occur.&lt;br /&gt;
&lt;br /&gt;
'''The code given below illustrates I2C transaction split into functions, but this is the wrong way of writing an I2C driver.  An I2C driver should be &amp;quot;transaction-based&amp;quot; and the entire transfer should be carried out using a state machine.  The idea is to design your software to walk the I2C hardware through its state to complete an I2C transfer.'''&lt;br /&gt;
&lt;br /&gt;
In the diagrams given below, your software should take the step given in the arrow, and the hardware will go to the next state granted that no errors occur.  To implement this in your software, you should follow the following steps :&lt;br /&gt;
#  Perform the action given by the arrow&lt;br /&gt;
#  Clear the &amp;quot;SI&amp;quot; (state change) bit for HW to take the next step&lt;br /&gt;
#  Wait for &amp;quot;SI&amp;quot; (state change) bit to set, then take the next action&lt;br /&gt;
&lt;br /&gt;
The master will always initiate the transfer, and the device reading the data should always &amp;quot;ACK&amp;quot; the byte.  For example, the master sends the 8-bit address after the START condition and the addressed slave should ACK the 9th bit (pull the line LOW).  Likewise, when the master sends the first byte after the address, the slave should ACK that byte if it wishes to continue the transfer.&lt;br /&gt;
&lt;br /&gt;
When the master enters the &amp;quot;read mode&amp;quot; after transmitting the read address after a repeat-start, the master begins to &amp;quot;ACK&amp;quot; each byte that the slave sends.  When the master &amp;quot;NACKs&amp;quot;, it is an indication to the slave that it doesn't want to read anymore bytes from the slave.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
=== Write Transaction ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Code Sample&lt;br /&gt;
| State Machine&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
A typical I2C write is to be able to write a register or memory address on a slave device.  Here are the steps:&lt;br /&gt;
#  Master sends START condition followed by device address.&lt;br /&gt;
#:  Device should then &amp;quot;ACK&amp;quot; using 9th bit.&lt;br /&gt;
#  Master sends device's &amp;quot;memory address&amp;quot; (1 or more bytes).&lt;br /&gt;
#:  Each byte should be ACK'd by slave.&lt;br /&gt;
#  Master sends the data to write (1 or more bytes).&lt;br /&gt;
#:  Each byte should be ACK'd by slave.&lt;br /&gt;
#  Master sends the STOP condition.&lt;br /&gt;
&lt;br /&gt;
To maximize throughput and avoid having to do this for each memory location, the memory address is considered &amp;quot;starting address&amp;quot;.  If we continue to write data, we will end up writing data to M, M+1, M+2 etc.&lt;br /&gt;
&lt;br /&gt;
The ideal way of writing an I2C driver is one that is able to carry out an entire transaction given by the function below.  Note that the function only shows the different actions hardware should take to carry out the transaction, but your software should be state machine based as illustrated on the state machine diagram on the right.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
void i2c_write_slave_reg(void)&lt;br /&gt;
{&lt;br /&gt;
    i2c_start();&lt;br /&gt;
    i2c_write(slave_addr);&lt;br /&gt;
    i2c_write(slave_reg);&lt;br /&gt;
    i2c_write(data);&lt;br /&gt;
    &lt;br /&gt;
    /* Optionaly write more data to slave_reg+1, slave_reg+2 etc. */&lt;br /&gt;
    // i2c_write(data); /* M + 1 */&lt;br /&gt;
    // i2c_write(data); /* M + 2 */&lt;br /&gt;
&lt;br /&gt;
    i2c_stop();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|  [[File:tutorial_i2c_write.png|center|frame|I2C Write Transaction]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Read Transaction ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Code Sample&lt;br /&gt;
| State Machine&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
An I2C read is slightly more complex and involves more protocol to follow.  What we have to do is switch from &amp;quot;write-mode&amp;quot; to &amp;quot;read-mode&amp;quot; by sending a repeat start, but this time with an ODD address.  To simplify things, you can consider an I2C even address being &amp;quot;write-mode&amp;quot; and I2C odd address being &amp;quot;read-mode&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Again, the function shows what we want to accomplish.  The actual driver should use state machine logic to carry-out the entire transaction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
void i2c_write_slave_reg(void)&lt;br /&gt;
{&lt;br /&gt;
    i2c_start();&lt;br /&gt;
    i2c_write(slave_addr);&lt;br /&gt;
    i2c_write(slave_reg);&lt;br /&gt;
   &lt;br /&gt;
    i2c_start();                  // Repeat start&lt;br /&gt;
    i2c_write(slave_addr | 0x01); // Odd address&lt;br /&gt;
    &lt;br /&gt;
    char data = i2c_read(0);      // NACK if reading last byte&lt;br /&gt;
&lt;br /&gt;
    /* If we wanted to read 3 register, it would look like this:&lt;br /&gt;
     * char d1 = i2c_read(1);&lt;br /&gt;
     * char d2 = i2c_read(1);&lt;br /&gt;
     * char d3 = i2c_read(0);&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
    i2c_stop();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|  [[File:tutorial_i2c_read.png|center|frame|I2C Read Transaction]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== I2C Slave State Machine Planning ==&lt;br /&gt;
Before you jump right into the assignment, do the following:&lt;br /&gt;
*  Read and understand how an I2C master performs slave register read and write operation&lt;br /&gt;
*:  Look at existing code to see how the master operation handles the I2C state machine function&lt;br /&gt;
*:  This is important so you can understand the existing code base&lt;br /&gt;
*  Next to each of the master state, determine which slave state is entered when the master enters its state&lt;br /&gt;
*  Determine how your slave memory or registers will be read or written&lt;br /&gt;
&lt;br /&gt;
''' It is important to understand the states, and use the datasheet to figure out what to do in the state to reach the next desired state given in the diagrams below. '''&lt;br /&gt;
&lt;br /&gt;
=== Master Write ===&lt;br /&gt;
In the diagram below, note that when the master sends the &amp;quot;R#&amp;quot;, which is the register to write, the slave state machine should save this data byte as it's INDEX location.  Upon the next data byte, the indexed data byte should be written.&lt;br /&gt;
&lt;br /&gt;
[[File:tutorial_i2c_master_write_state.png|center|frame|I2C Master Write Transaction]]&lt;br /&gt;
&lt;br /&gt;
=== Master Read ===&lt;br /&gt;
In the diagram below, the master will write the index location (the first data byte), and then perform a repeat start.  After that, you should start returning your indexed data bytes.&lt;br /&gt;
&lt;br /&gt;
[[File:tutorial_i2c_master_read_state.png|center|frame|I2C Master Read Transaction]]&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== I2C State Machine Assignment ===&lt;br /&gt;
Design your I2C state machine.  Look at the &amp;quot;Master Write&amp;quot; and &amp;quot;Master Read&amp;quot;, and do the following:&lt;br /&gt;
&lt;br /&gt;
*Right underneath the Master State, determine which state the slave will enter when the master is in each of the states&lt;br /&gt;
*In each slave state, determine the action you will perform for the transaction&lt;br /&gt;
*You can design your own state machine, or augment the existing one, whichever method can yield the maximum clarify for your I2C slave state.&lt;br /&gt;
&lt;br /&gt;
=== I2C Code Assignment ===&lt;br /&gt;
==== Assignment Outline ====&lt;br /&gt;
&amp;lt;b&amp;gt;This is a group of two assignment; submit one copy of code per team and put down the names of your group members as part of the source code you turn in.  Only turn in the new code you added, not the entire file.&amp;lt;/b&amp;gt;&lt;br /&gt;
* The I2C#2 driver is already implemented and used for on-board sensors.&lt;br /&gt;
* Study the existing I2C code: i2c_base.cpp.  Please ask any questions if you have any, but the driver was implemented using the state machine diagrams given at the below wikipedia page.&lt;br /&gt;
* On your master board, you can just use i2c terminal command to write a register to the other board which is acting as a slave.  Hence, you only need to write code on one board (I2C slave board).&lt;br /&gt;
&lt;br /&gt;
==== Guidelines ====&lt;br /&gt;
Design an I2C slave interface, and use one person's board as MASTER and communicate with the second person's SLAVE board.  Here are the guidelines:&lt;br /&gt;
Extend the I2C base class to also support slave operation.  Test your I2C driver by using one board as a master, and another board as a slave.&lt;br /&gt;
#  Study &amp;lt;B&amp;gt;&amp;lt;CODE&amp;gt;i2c_base.cpp&amp;lt;/CODE&amp;gt;&amp;lt;/B&amp;gt;, particularly the following methods:&lt;br /&gt;
#*  &amp;lt;B&amp;gt;&amp;lt;CODE&amp;gt;init()&amp;lt;/CODE&amp;gt;&amp;lt;/B&amp;gt;&lt;br /&gt;
#*  &amp;lt;B&amp;gt;&amp;lt;CODE&amp;gt;i2cStateMachine()&amp;lt;/CODE&amp;gt;&amp;lt;/B&amp;gt;&lt;br /&gt;
#*:  Note that this function is called by the hardware interrupt asynchronously whenever I2C state changes.&lt;br /&gt;
#*:  The other I2C master will simply &amp;quot;kick off&amp;quot; the START state, and this function carries the hardware through its states to carry out the transaction.&lt;br /&gt;
#*   The functions you add to this base class are accessible by the I2C2 instance.&lt;br /&gt;
#  Add &amp;lt;B&amp;gt;&amp;lt;CODE&amp;gt;initSlave()&amp;lt;/CODE&amp;gt;&amp;lt;/B&amp;gt; method to the I2C to initialize the slave operation.&lt;br /&gt;
#*  Allow the user to supply a memory to be read or written by another master.&lt;br /&gt;
#  Extend the state machine for I2C slave operation.&lt;br /&gt;
#*  Study the CPU user manual first, and create a state machine diagram on paper.&lt;br /&gt;
#*  The first register supplied after the slave address should be used as an &amp;quot;offset&amp;quot; of the memory to read or write.&lt;br /&gt;
#  Demonstrate the following :&lt;br /&gt;
#*  Demonstrate that you are able to read and write the slave memory.&lt;br /&gt;
#*  For extra credit and bragging rights, create state machine diagrams, and if you can make better ones, I will use your diagrams at this wikipedia page :)&lt;br /&gt;
&lt;br /&gt;
=== Sample Code ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;i2c2.hpp&amp;quot;&lt;br /&gt;
#include &amp;lt;stdint.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
    I2C2&amp;amp; i2c = I2C2::getInstance(); // Get I2C driver instance&lt;br /&gt;
    const uint8_t slaveAddr = 0xC0;  // Pick any address other than the used used at i2c2.hpp&lt;br /&gt;
    uint8_t buffer[256] = { 0 };     // Our slave read/write buffer&lt;br /&gt;
&lt;br /&gt;
    // high_level_init() will init() I2C, let's init slave&lt;br /&gt;
    i2c.initSlave(slaveAddr, &amp;amp;buffer, sizeof(buffer));&lt;br /&gt;
&lt;br /&gt;
    // I2C interrupt will (should) modify our buffer.&lt;br /&gt;
    // So just monitor our buffer, and print and/or light up LEDs&lt;br /&gt;
    // ie: If buffer[0] == 0, then LED ON, else LED OFF&lt;br /&gt;
    uint8_t prev = buffer[0];&lt;br /&gt;
    while(1)&lt;br /&gt;
    {&lt;br /&gt;
        if (prev != buffer[0]) {&lt;br /&gt;
            prev = buffer[0];&lt;br /&gt;
            printf(&amp;quot;buffer[0] changed to %#x\n&amp;quot;, buffer[0]);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Warning ===&lt;br /&gt;
Since the I2C state machine function is called from inside an interrupt, you may not be able to to use &amp;lt;B&amp;gt;&amp;lt;CODE&amp;gt;printf()&amp;lt;/CODE&amp;gt;&amp;lt;/B&amp;gt;, especially if you are running FreeRTOS.  As an alternative, use the debug printf methods from the &amp;lt;B&amp;gt;&amp;lt;CODE&amp;gt;printf_lib.h&amp;lt;/CODE&amp;gt;&amp;lt;/B&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
=== Hints ===&lt;br /&gt;
*  Start by hooking up master microcontroller running the default, unmodified sample FreeRTOS project&lt;br /&gt;
*  Familiarize yourself with the master microcontroller I2C commands: &amp;quot;help i2c&amp;quot;&lt;br /&gt;
*  Initialize the slave microcontroller's slave address such that you will get an interrupt when your address is sent by the master microcontroller&lt;br /&gt;
*  Add printfs to the I2C state machine code to identify what states you enter when the other master microcontroller is trying to do an I2C transaction&lt;br /&gt;
*  Follow your diagram and figure out how to make the I2C slave state machine walk through to read and write registers&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_UART&amp;diff=51338</id>
		<title>Embedded System Tutorial UART</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_UART&amp;diff=51338"/>
				<updated>2019-01-25T20:05:38Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Socialledge is moving to two portals.  &lt;br /&gt;
*  The Wiki will remain here for general references about the SJ-One board, and to document student reports.&lt;br /&gt;
*  The bookstack will now be used for SJSU assignments&lt;br /&gt;
&lt;br /&gt;
[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/chapter/lesson-uart This article has been moved here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The objective of this lesson is to understand UART, and use two boards and setup UART communication between them.&lt;br /&gt;
&lt;br /&gt;
'''UART''' stands for '''U'''niversal '''A'''synchronous '''R'''eceiver '''T'''ransmitter.  There is one wire for transmitting data, and one wire to receive data.   A common parameter is the baud rate known as &amp;quot;bps&amp;quot; which stands for '''b'''its '''p'''er '''s'''econd.  If a transmitter is configured with 9600bps, then the receiver must be listening on the other end at the same speed.&lt;br /&gt;
&lt;br /&gt;
UART is a serial communication, so bits must travel on a single wire.  If you wish to send a '''char''' over UART, the char is enclosed within a '''start''' and a '''stop''' bit, so to send 8-bits of '''char''' data, it would require 2-bit overhead; this 10-bit of information is called a '''UART frame'''.  Let's take a look at how the character 'A' is sent over UART.  In ASCII table, the character 'A' has the value of 65, which in binary is: 0100-0001.  If you inform your UART hardware that you wish to send this data at 9600bps, here is how the frame would appear on an oscilloscope :&lt;br /&gt;
[[File:uart_tutorial_frame.jpg|center|frame|UART Frame of 'A']]&lt;br /&gt;
&lt;br /&gt;
A micrcontroller can have multiple UARTs in its hardware, and usually UART0 is interfaced to a &amp;quot;USB to serial&amp;quot; converter chip which is then connected to your computer.  In this exercise, you will write a driver for UART-2 and attempt to communicate between two boards.&lt;br /&gt;
&lt;br /&gt;
I encourage you to fully read this article first, and here is a video about the UART0 tutorial.  This is a FAST PACED video, so learn to pause the video and look over your LPC user manual frequently :)  '''Note that I forgot to configure the PINSEL registers, which are covered by this tutorial below.'''&lt;br /&gt;
*  [https://www.youtube.com/watch?v=RU_NUPprx2Y UART Driver Video]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== UART Pins ==&lt;br /&gt;
Before you write a UART software driver, you need to understand the physical constraints and identify the UART pins on your processor.  A GPIO (general purpose input output) is a multi-purpose pin, and certain pins are used for certain functions.  For example, P0.0 and P0.1 on your LPC17xx processor can be used for an LED (output), a switch (input), or as UART transmitter and receive signals.  We will configure the microcontroller's internal MUX (multiplexor) to connect internal UART to external pins.&lt;br /&gt;
&lt;br /&gt;
[[File:tutorial_uart_pinsel.png|center|Find RXD2 and TXD2 of UART2]]&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
[[File:tutorial_gpio_mux.png|center|Example MUX that we need to configure for a PIN selection]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clock System &amp;amp; Timing ==&lt;br /&gt;
A crystal drives a processor clock, and it is usually less than 20Mhz.  A processor usually uses a &amp;quot;PLL&amp;quot; or &amp;quot;phased-lock-loop&amp;quot; to generate a faster clock than the crystal.  So, you could have a 4Mhz clock, and the PLL can be used to internally multiply the clock to provide 48Mhz to the processor.  The same 48Mhz is then fed to processor peripherals, and sometimes you have a register that can divide this higher clock to slower peripherals that may not require a high clock rate.  Remember that lower clock speed means lower power consumption.&lt;br /&gt;
&lt;br /&gt;
9600bps means that one bit takes 1/9600 = 104uS (micro-seconds) per bit.  The idea is that we want to divide the peripheral clock to UART hardware by a number that yields roughly 104uS per bit.  The '''Software Driver''' section goes over how to configure your UART driver to divide the clock to yield the desired baud rate.&lt;br /&gt;
&lt;br /&gt;
[[File:uart_tutorial_clock.jpg|center|frame|Example clock system of LPC17xx]]&lt;br /&gt;
&lt;br /&gt;
== Hardware Design ==&lt;br /&gt;
There is not much hardware design other than to locate UART-2 pins on your processor board and connecting these wires to the second board.  Each pin on a microcontroller may be designed to provide specific feature.  So the first thing to do is identify which physical pins can provide UART-2 signals.&lt;br /&gt;
&lt;br /&gt;
After you identify the physical pins, you would connect these pins to the second board.  '''Remember that your TX pin should be connected to second board's RX pin''' and vice versa.  Connecting two TX pins together will damage your processor.  After you connect the Rx/Tx pairs together, you also need to connect the '''ground''' wire of two boards together.  Not connecting the ground reference together is essentially like asking the other board &amp;quot;How far is my hand from the ground&amp;quot; when the ground reference is missing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software Driver ==&lt;br /&gt;
[[File:uart_tutorial_overview.jpg|center|frame|UART chapter summary]]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| &lt;br /&gt;
The UART chapter on LPC17xx has a really good summary page on how to write a UART driver.  '''Read the register description of each UART register to understand how to write a driver.'''  This tutorial gives away answers but unless you spend 1-2 hours reading the UART chapter, you will forget this knowledge.  The datasheet shows many registers but remember that for a simple driver, we will not need interrupts so you can skip the sections that talk about the UART interrupts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
Writing a uart initialization routine is simple except that some registers require a special setup to access them.  In the sample code below, we power up UART0, and use the PINSEL register to configure the Rx/Tx Uart pins as the pin functionality.  Finally, we just set the divider to achieve 9600bps.  The exception here is that we have to read the datasheet carefully which states that the '''DLM''' and the '''DLL''' registers are only accessible if the '''DLAB''' bit is set at the '''LCR''' register.&lt;br /&gt;
&lt;br /&gt;
Notice that four registers have the same address.  The UART divider registers are only accessible if DLAB bit is 1; this was done to protect accidental change of baud rate.  Furthermore, notice that the CPU is intelligent enough to know if you are accessing the RX or the TX register based on if the register is being read or written.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
void uart0_init(void)&lt;br /&gt;
{&lt;br /&gt;
    LPC_SC-&amp;gt;PCONP |= (1 &amp;lt;&amp;lt; 3);       // Enable power to UART0&lt;br /&gt;
    LPC_SC-&amp;gt;PCLKSEL0 &amp;amp;= ~(3 &amp;lt;&amp;lt; 6);&lt;br /&gt;
    LPC_SC-&amp;gt;PCLKSEL0 |=  (1 &amp;lt;&amp;lt; 6);   // Uart clock = CPU / 1&lt;br /&gt;
&lt;br /&gt;
    LPC_PINCON-&amp;gt;PINSEL0 &amp;amp;= ~(0xF &amp;lt;&amp;lt; 4); // Clear values&lt;br /&gt;
    LPC_PINCON-&amp;gt;PINSEL0 |= (0x5 &amp;lt;&amp;lt; 4);  // Set values for UART0 Rx/Tx&lt;br /&gt;
&lt;br /&gt;
    LPC_UART0-&amp;gt;LCR = (1 &amp;lt;&amp;lt; 7);	// Enable DLAB&lt;br /&gt;
    /* See the formula picture to get more info.&lt;br /&gt;
     * Default values of fractional dividers simplifies the equation&lt;br /&gt;
     * Warning: You need to set DLM/DLL correctly, but if divider is small enough, it will fit inside DLL&lt;br /&gt;
     */&lt;br /&gt;
    LPC_UART0-&amp;gt;DLM = 0;&lt;br /&gt;
    LPC_UART0-&amp;gt;DLL = CPU_CLOCK / (16 * 9600) + 0.5);&lt;br /&gt;
&lt;br /&gt;
    LPC_UART0-&amp;gt;LCR = 3;         // 8-bit data&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
| [[File:uart_tutorial_dlab.jpg|center|frame|DLAB bit to access registers]]&lt;br /&gt;
  [[File:uart_tutorial_formula.jpg|center|frame|Baud rate formula]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
char uart0_putchar(char out)&lt;br /&gt;
{&lt;br /&gt;
    LPC_UART0-&amp;gt;THR = out;&lt;br /&gt;
    while(! (LPC_UART0-&amp;gt;LSR &amp;amp; (1 &amp;lt;&amp;lt; 6)));&lt;br /&gt;
    return 1;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
To send a char over UART, the code looks incredibly easy; just two lines!  It is supposed to be very easy because the UART hardware is supposed to handle the UART frame, and send start bit, followed by 8-data bits, and a stop bit by simply writing the '''THR''' register.  The moment you write this register, the hardware will start shifting bits out of the wire.  The while loop is present because after you write the '''THR''' register, we want to wait until hardware is done sending the bits out of the wire otherwise writing the same register again will corrupt the on-going transfer.&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advanced Design ==&lt;br /&gt;
What you've done so far is wrote a polling UART driver.  If you used 9600bps, and sent 1000 characters, your processor would basically enter a &amp;quot;busy-wait&amp;quot; loop and spend 1040ms to send 1000 bytes of data.  You can enhance this behavior by allowing your &amp;lt;code&amp;gt;uart_putchar()&amp;lt;/code&amp;gt; function to enter data to a queue, and return immediately, and you can use the &amp;quot;THRE&amp;quot; or &amp;quot;Transmitter Holding Register Empty&amp;quot; interrupt indicator to remove your busy-wait loop while you wait for a character to be sent.&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
* &amp;lt;b&amp;gt;Assignment Outline&amp;lt;/b&amp;gt;&lt;br /&gt;
*: Form 2 people teams for this assignment.&lt;br /&gt;
*: Write a driver for UART2 or UART3&lt;br /&gt;
*: Do not use the pre-built driver or Uart2/3 class&lt;br /&gt;
*: Connect your UART to your partner's UART (to his board)&lt;br /&gt;
*: Prove that you can send/receive data across multiple boards.&lt;br /&gt;
*: Upload Logic Analyzer Screenshot for the UART Frame.&lt;br /&gt;
* &amp;lt;b&amp;gt;Extra Credit&amp;lt;/b&amp;gt;: &lt;br /&gt;
*: Use Uart interrupt to queue the received data to avoid polling.  You just need to enable UART RX interrupt and then hookup an interrupt callback to do the receive.&lt;br /&gt;
* &amp;lt;b&amp;gt;Steps&amp;lt;/b&amp;gt;&lt;br /&gt;
*: Locate the physical pins for a UART that is not already used by your board&lt;br /&gt;
*: Configure the PINSEL to use the pins for UART Rx/Tx&lt;br /&gt;
*: Initialize your UART at any baud rate&lt;br /&gt;
*: Write uart_putchar(char) and uart_getchar() functions&lt;br /&gt;
*: Interface your UART with someone else's board, and test the communication.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_GPIO&amp;diff=51337</id>
		<title>Embedded System Tutorial GPIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_GPIO&amp;diff=51337"/>
				<updated>2019-01-25T20:02:33Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Socialledge is moving to two portals.  &lt;br /&gt;
*  The Wiki will remain here for general references about the SJ-One board, and to document student reports.&lt;br /&gt;
*  The bookstack will now be used for SJSU assignments&lt;br /&gt;
&lt;br /&gt;
[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/chapter/lesson-gpio This article has been moved here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Objective ==&lt;br /&gt;
Interface your LPC17xx to a switch and an LED.&lt;br /&gt;
&lt;br /&gt;
Although the interface may seem simple, you do need to consider hardware design and know some of the fundamental of electricity.  There are a couple of goals for us :&lt;br /&gt;
*  No hardware damage if faulty software is written.&lt;br /&gt;
*  Circuit should prevent excess amount of current to avoid processor damage.&lt;br /&gt;
&lt;br /&gt;
== Required Background ==&lt;br /&gt;
*  You should know how to bit-mask variables&lt;br /&gt;
*  You should know how to wire-wrap&lt;br /&gt;
*  You should know fundamentals of electricity and the famous '''V = IR''' equation.&lt;br /&gt;
&lt;br /&gt;
== GPIO ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
GPIO stands for &amp;quot;General Purpose Input Output&amp;quot;.  Each pin can at least be used as an output or input.  In an output configuration, the pin voltage is either 0v or 3.3v.  In input mode, we can read whether the voltage is 0v or 3.3v.&lt;br /&gt;
&lt;br /&gt;
You can locate a GPIO that you wish to use for a switch or an LED by first starting with the schematic of the board.  The schematic will show which pins are &amp;quot;available&amp;quot; because some of the microcontroller pins may be used internally by your development board.  After you locate a free pin, such as P2.0, then you can look-up the microcontroller user manual to locate the memory that you can manipulate.&lt;br /&gt;
&lt;br /&gt;
|[[File:tutorial_gpio_design.png|center|frame|GPIO Design]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Coding ==&lt;br /&gt;
=== Hardware Registers ===&lt;br /&gt;
The hardware registers map to physical pins.  If we want to attach our switch and the LED to our microcontroller's PORT0, then here are the relevant registers and their functionality :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+LPC17xx Port0 Registers&lt;br /&gt;
|-&lt;br /&gt;
|'''LPC_GPIO0-&amp;gt;FIODIR'''&lt;br /&gt;
|Direction of the port pins, 1 = output&lt;br /&gt;
|-&lt;br /&gt;
|'''LPC_GPIO0-&amp;gt;FIOPIN'''&lt;br /&gt;
|&lt;br /&gt;
 Read : Sensed inputs of the port pins, 1 = HIGH&lt;br /&gt;
 Write : Control voltage level of the pin, 1 = 3.3v&lt;br /&gt;
|-&lt;br /&gt;
|'''LPC_GPIO0-&amp;gt;FIOSET'''&lt;br /&gt;
|Write only : Any bits written 1 are OR'd with FIOPIN&lt;br /&gt;
|-&lt;br /&gt;
|'''LPC_GPIO0-&amp;gt;FIOCLR'''&lt;br /&gt;
|Write only : Any bits written 1 are AND'd with FIOPIN&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
=== Switch ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ We will interface our switch to PORT0.2, or port zero's 3rd pin (counting from 0).&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Make direction of PORT0.2 as input */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIODIR &amp;amp;= ~(1 &amp;lt;&amp;lt; 2);&lt;br /&gt;
&lt;br /&gt;
/* Now, simply read the 32-bit FIOPIN registers, which corresponds to&lt;br /&gt;
 * 32 physical pins of PORT0.  We use AND logic to test if JUST the&lt;br /&gt;
 * pin number 2 is set&lt;br /&gt;
 */&lt;br /&gt;
if (LPC_GPIO0-&amp;gt;FIOPIN &amp;amp; (1 &amp;lt;&amp;lt; 2)) {&lt;br /&gt;
    // Switch is logical HIGH&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
    // Switch is logical LOW&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|Note that the &amp;quot;inline&amp;quot; resistor is used such that if your GPIO is mis-configured as an OUTPUT pin, hardware damage will not occur from badly written software.&lt;br /&gt;
[[File:gpio_switch_circuit.png|center|frame|Switch Circuit]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== LED ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ We will interface our LED to PORT0.3, or port zero's 4th pin (counting from 0).&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Make direction of PORT0.3 as OUTPUT */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIODIR |= (1 &amp;lt;&amp;lt; 3);&lt;br /&gt;
&lt;br /&gt;
/* Setting bit 3 to 1 of IOPIN will turn ON LED&lt;br /&gt;
 * and resetting to 0 will turn OFF LED.&lt;br /&gt;
 */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIOPIN |= (1 &amp;lt;&amp;lt; 3);&lt;br /&gt;
&lt;br /&gt;
/* Faster, better way to set bit 3 (no OR logic needed) */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIOSET = (1 &amp;lt;&amp;lt; 3);&lt;br /&gt;
&lt;br /&gt;
/* Likewise, reset to 0 */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIOCLR = (1 &amp;lt;&amp;lt; 3);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|Given below are two configurations of an LED.  Usually, the &amp;quot;sink&amp;quot; current is higher than &amp;quot;source&amp;quot;, hence the active-low configuration is used more often.&lt;br /&gt;
[[File:gpio_led_active_low.png|center|frame|Active-low LED circuit]] [[File:gpio_led_active_high.png|center|frame|Active-high LED circuit]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
At the end of this lab, you should be familiar with how a microcontroller's memory can access physical pins.  Test your knowledge by doing the following:&lt;br /&gt;
*  Interface your board's GPIO pin to an external switch&lt;br /&gt;
*  Interface your board's GPIO pin to an LED&lt;br /&gt;
*  If the switch is pressed, light up an LED&lt;br /&gt;
*  Do not use any pre-existing library such as a GPIO class&lt;br /&gt;
&lt;br /&gt;
Upload into the textbox just the relevant code, probably just main.cpp&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Extra Credit:&amp;lt;/b&amp;gt; Do something creative, such as lighting up an LED based on a terminal command.&lt;br /&gt;
&lt;br /&gt;
[[Embedded System GPIO Assignment]]&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_Tasks&amp;diff=51336</id>
		<title>Embedded System Tutorial Tasks</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_Tasks&amp;diff=51336"/>
				<updated>2019-01-25T19:55:41Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Socialledge is moving to two portals.  &lt;br /&gt;
*  The Wiki will remain here for general references about the SJ-One board, and to document student reports.&lt;br /&gt;
*  The bookstack will now be used for SJSU assignments&lt;br /&gt;
&lt;br /&gt;
[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/lab-assignment-freertos-tasks This article has been moved here]&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_Tasks&amp;diff=51335</id>
		<title>Embedded System Tutorial Tasks</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_Tasks&amp;diff=51335"/>
				<updated>2019-01-25T17:07:27Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Socialledge is moving to two portals.  &lt;br /&gt;
*  The Wiki will remain here for general references about the SJ-One board, and to document student reports.&lt;br /&gt;
*  The bookstack will now be used for SJSU assignments&lt;br /&gt;
&lt;br /&gt;
[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/chapter/lesson-gpio This article has been moved here]&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_GPIO&amp;diff=51334</id>
		<title>Embedded System Tutorial GPIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Embedded_System_Tutorial_GPIO&amp;diff=51334"/>
				<updated>2019-01-25T17:05:14Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hello world&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Objective ==&lt;br /&gt;
Interface your LPC17xx to a switch and an LED.&lt;br /&gt;
&lt;br /&gt;
Although the interface may seem simple, you do need to consider hardware design and know some of the fundamental of electricity.  There are a couple of goals for us :&lt;br /&gt;
*  No hardware damage if faulty software is written.&lt;br /&gt;
*  Circuit should prevent excess amount of current to avoid processor damage.&lt;br /&gt;
&lt;br /&gt;
== Required Background ==&lt;br /&gt;
*  You should know how to bit-mask variables&lt;br /&gt;
*  You should know how to wire-wrap&lt;br /&gt;
*  You should know fundamentals of electricity and the famous '''V = IR''' equation.&lt;br /&gt;
&lt;br /&gt;
== GPIO ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
GPIO stands for &amp;quot;General Purpose Input Output&amp;quot;.  Each pin can at least be used as an output or input.  In an output configuration, the pin voltage is either 0v or 3.3v.  In input mode, we can read whether the voltage is 0v or 3.3v.&lt;br /&gt;
&lt;br /&gt;
You can locate a GPIO that you wish to use for a switch or an LED by first starting with the schematic of the board.  The schematic will show which pins are &amp;quot;available&amp;quot; because some of the microcontroller pins may be used internally by your development board.  After you locate a free pin, such as P2.0, then you can look-up the microcontroller user manual to locate the memory that you can manipulate.&lt;br /&gt;
&lt;br /&gt;
|[[File:tutorial_gpio_design.png|center|frame|GPIO Design]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Coding ==&lt;br /&gt;
=== Hardware Registers ===&lt;br /&gt;
The hardware registers map to physical pins.  If we want to attach our switch and the LED to our microcontroller's PORT0, then here are the relevant registers and their functionality :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+LPC17xx Port0 Registers&lt;br /&gt;
|-&lt;br /&gt;
|'''LPC_GPIO0-&amp;gt;FIODIR'''&lt;br /&gt;
|Direction of the port pins, 1 = output&lt;br /&gt;
|-&lt;br /&gt;
|'''LPC_GPIO0-&amp;gt;FIOPIN'''&lt;br /&gt;
|&lt;br /&gt;
 Read : Sensed inputs of the port pins, 1 = HIGH&lt;br /&gt;
 Write : Control voltage level of the pin, 1 = 3.3v&lt;br /&gt;
|-&lt;br /&gt;
|'''LPC_GPIO0-&amp;gt;FIOSET'''&lt;br /&gt;
|Write only : Any bits written 1 are OR'd with FIOPIN&lt;br /&gt;
|-&lt;br /&gt;
|'''LPC_GPIO0-&amp;gt;FIOCLR'''&lt;br /&gt;
|Write only : Any bits written 1 are AND'd with FIOPIN&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
=== Switch ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ We will interface our switch to PORT0.2, or port zero's 3rd pin (counting from 0).&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Make direction of PORT0.2 as input */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIODIR &amp;amp;= ~(1 &amp;lt;&amp;lt; 2);&lt;br /&gt;
&lt;br /&gt;
/* Now, simply read the 32-bit FIOPIN registers, which corresponds to&lt;br /&gt;
 * 32 physical pins of PORT0.  We use AND logic to test if JUST the&lt;br /&gt;
 * pin number 2 is set&lt;br /&gt;
 */&lt;br /&gt;
if (LPC_GPIO0-&amp;gt;FIOPIN &amp;amp; (1 &amp;lt;&amp;lt; 2)) {&lt;br /&gt;
    // Switch is logical HIGH&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
    // Switch is logical LOW&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|Note that the &amp;quot;inline&amp;quot; resistor is used such that if your GPIO is mis-configured as an OUTPUT pin, hardware damage will not occur from badly written software.&lt;br /&gt;
[[File:gpio_switch_circuit.png|center|frame|Switch Circuit]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== LED ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ We will interface our LED to PORT0.3, or port zero's 4th pin (counting from 0).&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Make direction of PORT0.3 as OUTPUT */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIODIR |= (1 &amp;lt;&amp;lt; 3);&lt;br /&gt;
&lt;br /&gt;
/* Setting bit 3 to 1 of IOPIN will turn ON LED&lt;br /&gt;
 * and resetting to 0 will turn OFF LED.&lt;br /&gt;
 */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIOPIN |= (1 &amp;lt;&amp;lt; 3);&lt;br /&gt;
&lt;br /&gt;
/* Faster, better way to set bit 3 (no OR logic needed) */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIOSET = (1 &amp;lt;&amp;lt; 3);&lt;br /&gt;
&lt;br /&gt;
/* Likewise, reset to 0 */&lt;br /&gt;
LPC_GPIO0-&amp;gt;FIOCLR = (1 &amp;lt;&amp;lt; 3);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|Given below are two configurations of an LED.  Usually, the &amp;quot;sink&amp;quot; current is higher than &amp;quot;source&amp;quot;, hence the active-low configuration is used more often.&lt;br /&gt;
[[File:gpio_led_active_low.png|center|frame|Active-low LED circuit]] [[File:gpio_led_active_high.png|center|frame|Active-high LED circuit]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
At the end of this lab, you should be familiar with how a microcontroller's memory can access physical pins.  Test your knowledge by doing the following:&lt;br /&gt;
*  Interface your board's GPIO pin to an external switch&lt;br /&gt;
*  Interface your board's GPIO pin to an LED&lt;br /&gt;
*  If the switch is pressed, light up an LED&lt;br /&gt;
*  Do not use any pre-existing library such as a GPIO class&lt;br /&gt;
&lt;br /&gt;
Upload into the textbox just the relevant code, probably just main.cpp&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Extra Credit:&amp;lt;/b&amp;gt; Do something creative, such as lighting up an LED based on a terminal command.&lt;br /&gt;
&lt;br /&gt;
[[Embedded System GPIO Assignment]]&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40314</id>
		<title>MP3 Player</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40314"/>
				<updated>2017-11-10T08:10:16Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: /* Project Requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Summary ==&lt;br /&gt;
The goal of this project is to create a fully functional MP3 music player using SJOne Microcontroller board as the source for music and control.&lt;br /&gt;
MP3 files will be present on an SD card. SJOne board reads these files and transfers data to a audio decoding peripheral for generating music.&lt;br /&gt;
User would be able to use player controls (start/stop/pause) for playing MP3 songs and view the track information on a display.&lt;br /&gt;
 &lt;br /&gt;
== Block Diagram ==&lt;br /&gt;
&lt;br /&gt;
[[File : Mp3_player_block_diagram.png|center|frame|]]&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
* Use the sdcard slot on SJOne microcontroller for reading MP3 files from a preloaded SD Card&lt;br /&gt;
* Use audio encoder/decoder peripheral board to decode mp3 data sent from SJ One Board using serial(preferably SPI) bus&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40313</id>
		<title>MP3 Player</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40313"/>
				<updated>2017-11-10T08:05:17Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: /* Project Requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Summary ==&lt;br /&gt;
The goal of this project is to create a fully functional MP3 music player using SJOne Microcontroller board as the source for music and control.&lt;br /&gt;
MP3 files will be present on an SD card. SJOne board reads these files and transfers data to a audio decoding peripheral for generating music.&lt;br /&gt;
User would be able to use player controls (start/stop/pause) for playing MP3 songs and view the track information on a display.&lt;br /&gt;
 &lt;br /&gt;
== Block Diagram ==&lt;br /&gt;
&lt;br /&gt;
[[File : Mp3_player_block_diagram.png|center|frame|]]&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
* Use the sdcard slot on SJOne microcontroller for reading MP3 files from a preloaded SD Card&lt;br /&gt;
* Use audio encoder/decoder peripheral interface board to decode mp3 data from SJ One Board using serial(preferably SPI) protocol&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40312</id>
		<title>MP3 Player</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40312"/>
				<updated>2017-11-10T08:00:43Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: /* Block Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Summary ==&lt;br /&gt;
The goal of this project is to create a fully functional MP3 music player using SJOne Microcontroller board as the source for music and control.&lt;br /&gt;
MP3 files will be present on an SD card. SJOne board reads these files and transfers data to a audio decoding peripheral for generating music.&lt;br /&gt;
User would be able to use player controls (start/stop/pause) for playing MP3 songs and view the track information on a display.&lt;br /&gt;
 &lt;br /&gt;
== Block Diagram ==&lt;br /&gt;
&lt;br /&gt;
[[File : Mp3_player_block_diagram.png|center|frame|]]&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40311</id>
		<title>MP3 Player</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40311"/>
				<updated>2017-11-10T07:58:52Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: /* Block Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Summary ==&lt;br /&gt;
The goal of this project is to create a fully functional MP3 music player using SJOne Microcontroller board as the source for music and control.&lt;br /&gt;
MP3 files will be present on an SD card. SJOne board reads these files and transfers data to a audio decoding peripheral for generating music.&lt;br /&gt;
User would be able to use player controls (start/stop/pause) for playing MP3 songs and view the track information on a display.&lt;br /&gt;
 &lt;br /&gt;
== Block Diagram ==&lt;br /&gt;
&lt;br /&gt;
[[File : Mp3_player_block_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Mp3_player_block_diagram.png&amp;diff=40310</id>
		<title>File:Mp3 player block diagram.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Mp3_player_block_diagram.png&amp;diff=40310"/>
				<updated>2017-11-10T07:56:59Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40309</id>
		<title>MP3 Player</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40309"/>
				<updated>2017-11-10T07:28:33Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Summary ==&lt;br /&gt;
The goal of this project is to create a fully functional MP3 music player using SJOne Microcontroller board as the source for music and control.&lt;br /&gt;
MP3 files will be present on an SD card. SJOne board reads these files and transfers data to a audio decoding peripheral for generating music.&lt;br /&gt;
User would be able to use player controls (start/stop/pause) for playing MP3 songs and view the track information on a display.&lt;br /&gt;
 &lt;br /&gt;
== Block Diagram ==&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40308</id>
		<title>MP3 Player</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40308"/>
				<updated>2017-11-10T06:54:23Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40307</id>
		<title>MP3 Player</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40307"/>
				<updated>2017-11-10T06:53:02Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: /* Project Requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Overview ==&lt;br /&gt;
The goal of this project is to create a fully functional MP3 player using SJOne Microcontroller board as the  &lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40306</id>
		<title>MP3 Player</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=MP3_Player&amp;diff=40306"/>
				<updated>2017-11-10T06:45:28Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: Created page with &amp;quot;== Project Requirements ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project Requirements ==&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Realtime_OS_on_Embedded_Systems&amp;diff=40305</id>
		<title>Realtime OS on Embedded Systems</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Realtime_OS_on_Embedded_Systems&amp;diff=40305"/>
				<updated>2017-11-10T06:44:29Z</updated>
		
		<summary type="html">&lt;p&gt;Sree: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Program History ==&lt;br /&gt;
My contribution in Embedded System courses started with CmpE146.  This course teaches students on how to write UART, SPI, and I2C Drivers and interface their drivers to peripherals.  There are about 8 weekly labs in which students not only write drivers, but also learn the core of Real-time Operating Systems including threading (tasks), and inter-task communication using Queues and Semaphores.  FreeRTOS is the operating system used with C/C++ Compiler based on GNU.&lt;br /&gt;
&lt;br /&gt;
When the course was started by Dr. Ozemek @ SJSU (sometime before 2005), not many resources were out there.  Still, with helpful guidance from Dr. Ozemek, interesting projects were created.  This is when I started to help out in Embedded System Courses, and by collecting and sharing knowledge, we've raised the bar at SJSU!  &lt;br /&gt;
&lt;br /&gt;
There have been many great projects at SJSU, but since no one knew about them, the hard work went to a waste for anyone but the creator.  But now we've got the infrastructure to share the projects, which turn out as great references for future students.  Here is my project that started around 2007, and turned into Bachelor's Senior Design Project: &amp;lt;br/&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=QEadXdRl3ws&amp;amp;feature=plcp YouTube Video of Self-Navigating Car]&lt;br /&gt;
&lt;br /&gt;
As of 2013, I have broadened my contribution to other embedded system courses like CmpE240, CmpE243 and CmpE244.&lt;br /&gt;
&lt;br /&gt;
== Lab Assignments ==&lt;br /&gt;
This article contains laboratory assignments and resources.  The assignments are under construction as we move towards SJ-One development board.&lt;br /&gt;
*  [[Embedded System Tutorial GPIO | Lesson 1 : GPIO]]&lt;br /&gt;
*  [[Embedded System Tutorial UART | Lesson 2 : UART]]&lt;br /&gt;
*  [[Embedded System Tutorial SPI  | Lesson 3 : SPI]]&lt;br /&gt;
*  [[Embedded System I2C Tutorial  | Lesson 4 : I2C]]&lt;br /&gt;
*  [[Embedded System Tutorial Interrupts | Lesson 5 : Interrupts]]&lt;br /&gt;
*  [[Embedded System Tutorial FreeRTOS | Lesson 6 : FreeRTOS Tasks]]&lt;br /&gt;
*  [[Embedded System Tutorial File I/O | Lesson 7 : FreeRTOS Application Programming]]&lt;br /&gt;
&lt;br /&gt;
==== Class Project ====&lt;br /&gt;
* [[MP3 Player]]&lt;br /&gt;
&lt;br /&gt;
==Other reference articles==&lt;br /&gt;
*  [[Bitmasking Tutorial]] (+ GPIO Example)&lt;br /&gt;
*  [[ LPC17xx Memory Map &amp;amp; Interrupts]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Senior Design Projects ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Semester Projects ==&lt;br /&gt;
Every semester, students are given about 7-10 weeks to complete their projects.  During this short time-span, students form groups, order parts, and begin working on their projects.  The work performed during the semester is documented at this Wiki.&lt;br /&gt;
&lt;br /&gt;
Here is the list of Preet's documented projects:&amp;lt;BR/&amp;gt;&lt;br /&gt;
*  [[Preet's Relay Controller Project]]&lt;br /&gt;
*  [[Nordic Low Powered Mesh Network stack]]&lt;br /&gt;
*  [http://www.youtube.com/watch?v=QEadXdRl3ws&amp;amp;feature=plcp Senior Design Project (MS-CmpE) Video]&lt;br /&gt;
&lt;br /&gt;
Here is another resource for good project references :&lt;br /&gt;
[http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/ Cornell EE476 Projects]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2017 | Spring 2017]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[S17: Wake up Barista]]&lt;br /&gt;
*  [[S17: Propeller Clock]]&lt;br /&gt;
*  [[S17: Sky Knight]]&lt;br /&gt;
*  [[S17: MyAutoHealth]]&lt;br /&gt;
*  [[S17: Logan]]&lt;br /&gt;
*  [[S17: ElectricBoard]]&lt;br /&gt;
*  [[S17: CamBot]]&lt;br /&gt;
*  [[S17: Sphero Droid]]&lt;br /&gt;
*  [[S17: Smart Planter]]&lt;br /&gt;
*  [[S17: Boom-Z Equalizer]]&lt;br /&gt;
*  [[S17: Interactive Snake and ladder ]]&lt;br /&gt;
*  [[S17: Smart Health Gear]]&lt;br /&gt;
*  [[S17: Halo]]&lt;br /&gt;
*  [[S17: Squad]]&lt;br /&gt;
*  [[S17: Smart security system]]&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2016 | Fall 2016]] ===&lt;br /&gt;
&lt;br /&gt;
CMPE146:&lt;br /&gt;
* [http://www.socialledge.com/sjsu/index.php?title=F16:_Seismograph F16: Seismograph]&lt;br /&gt;
* [[F16: Piano Glove]]&lt;br /&gt;
* [[F16: Object Detector]]&lt;br /&gt;
* [[F16: Autonomous Nautical System]]&lt;br /&gt;
* [[F16: Autonomous Fire Extinguishing Vehicle]]&lt;br /&gt;
* [[F16: Autonomous Runaway Alarm Car]]&lt;br /&gt;
* [[F16: E-Bike]]&lt;br /&gt;
* [[F16: NotifyBox]]&lt;br /&gt;
* [[F16: Wireless Tilt Controlled Camera Arm]]&lt;br /&gt;
* [[F16: OBD2 Reader]]&lt;br /&gt;
* [[F16: Micro Watch Monitoring System]]&lt;br /&gt;
* [[F16: Door Alarm System]]&lt;br /&gt;
* [[http://www.socialledge.com/sjsu/index.php?title=F16:_I2Coffee F16: UART Coffee]]&lt;br /&gt;
* [[F16: SJone to FPGA wireless integration]]&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2016 | Spring 2016]] ===&lt;br /&gt;
*  [[S16: Fantastic Four]]&lt;br /&gt;
*  [[S16: Simpsons]]&lt;br /&gt;
*  [[S16: Mars 1]]&lt;br /&gt;
*  [[S16: OpenSJ Bluz]]&lt;br /&gt;
*  [[S16: Motion Copy Bot]]&lt;br /&gt;
*  [[S16: Biker Assist]]&lt;br /&gt;
*  [[S16: Helios]]&lt;br /&gt;
*  [[S16: Sound Buddy]]&lt;br /&gt;
*  [[S16: Warriors]]&lt;br /&gt;
*  [[S16: Expendables]]&lt;br /&gt;
*  [[S16: Ahava]]&lt;br /&gt;
*  [[S16: Number 1]]&lt;br /&gt;
*  [[S16: SkyNet]]&lt;br /&gt;
*  [[S16: SmartDoorLock]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cmpe 146:&lt;br /&gt;
*  [[S16: Camera Gimbal]]&lt;br /&gt;
*  [[S16: Laser Harp]]&lt;br /&gt;
*  &amp;lt;strike&amp;gt;[[S16: Laser Cutter Motor Controller]]&amp;lt;/strike&amp;gt;&lt;br /&gt;
*  [[S16: Sprinkler]]&lt;br /&gt;
*  [[S16: The Jatrick Car]]&lt;br /&gt;
*  [[S16: Dan]]&lt;br /&gt;
*  [[S16: Robolamp]]&lt;br /&gt;
*  [[S16: Pinball]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2015 | Fall 2015]] ===&lt;br /&gt;
&lt;br /&gt;
CmpE146:&lt;br /&gt;
* [[F15: Autonomous Mobile]]&lt;br /&gt;
* [[F15: Car Report]]&lt;br /&gt;
* [[F15: Electronic Piano]]&lt;br /&gt;
* [[F15: Doorknock over Bluetooth]]&lt;br /&gt;
* [[F15: Smart Car]]&lt;br /&gt;
* [[F15: Plant Control]]&lt;br /&gt;
* [[F15: Laser Security System]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE244 Spring 2015 | Spring 2015]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[S15: Quadcopter - It flies]]&lt;br /&gt;
* [[S15: Remote Learner]]&lt;br /&gt;
* [[S15: Protocol Interface: I2C - CAN Bridge]]&lt;br /&gt;
* [[S15: Vision RC Car]]&lt;br /&gt;
* [[S15: SJeight Octocopter]]&lt;br /&gt;
* [[S15: Swarm Robots]]&lt;br /&gt;
* [[S15: Smart Sparta Parking System]]&lt;br /&gt;
* [[S15: Touch Navigator]]&lt;br /&gt;
* [[S15: Wizard's Chess System]]&lt;br /&gt;
* [[S15: Bug Rider]]&lt;br /&gt;
* [[S15: Real Time Brake Assist (RTBA)]]&lt;br /&gt;
* [[S15: Wireless Mesh Network]]&lt;br /&gt;
* [[S15: Wireless Power Transfer System]]&lt;br /&gt;
* [[S15: Drone]]&lt;br /&gt;
* [[S15: Tree Node using Google Protocol Buffers]]&lt;br /&gt;
* [[S15: Multi-media Car]]&lt;br /&gt;
* [[S15: Hand Gesture Recognition using IR Sensors]]&lt;br /&gt;
* [[S15: CAN controlled RGB LED cubes]]&lt;br /&gt;
* [[S15: Rubik's Cube Solver]]&lt;br /&gt;
* [[S15: RFID Security Box]]&lt;br /&gt;
* [[S15: Automated Meeting Room Reservation]]&lt;br /&gt;
* [[S15: Patient Buddy System (PBS)]]&lt;br /&gt;
&lt;br /&gt;
CmpE146:&lt;br /&gt;
* [[S15: Hovercopter]]&lt;br /&gt;
* [[S15: Triclops: Smart RC Car]]&lt;br /&gt;
* [[S15: Connect Four - Robotic Player]]&lt;br /&gt;
* [[S15: Self-Balancing Robot]]&lt;br /&gt;
* [[S15: MP3 Player with Graphic Equalizer Display]]&lt;br /&gt;
* [[S15: Motion-Controlled RC Car]]&lt;br /&gt;
* [[S15: MENL (Monster Encounter Night Light) ]]&lt;br /&gt;
* [[S15: Tilt Motion Controlled LED Alarm Clock]]&lt;br /&gt;
* [[S15: Alarm Based Coffee Maker]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE244 Spring 2014 | Spring 2014]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*  Senior Project: [[Project Advising: Remote Security System]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[S14: Quadcopter]]&lt;br /&gt;
* [[S14: Smart Weather Clock]]&lt;br /&gt;
* [[S14: Divine WINd]]&lt;br /&gt;
* [[S14: Data Acquisition using CAN bus]]&lt;br /&gt;
* [[S14: E-Ink Display for Shopping Tags]]&lt;br /&gt;
* [[S14: Spectrum Analyzer for Audio Frequency Signals]]&lt;br /&gt;
* [[S14: CAN Firmware Uploader]]&lt;br /&gt;
* [[S14: Asset Management and Location System]]&lt;br /&gt;
* [[S14: Location  Tracker]]&lt;br /&gt;
* [[S14:  Androbot]]&lt;br /&gt;
* [[S14: Virtual Dog]]&lt;br /&gt;
* [[S14: Android based Automation]]&lt;br /&gt;
* [[S14: FaceTime Robo]]&lt;br /&gt;
* [[S14: Wireless Control Car]]&lt;br /&gt;
* [[S14: Power Efficient Security Door System for Light-rail using CAN Bus]]&lt;br /&gt;
* [[S14: Android based home monitoring system]]&lt;br /&gt;
* [[S14: Need For Speed]]&lt;br /&gt;
&lt;br /&gt;
CmpE146&lt;br /&gt;
* [[S14: Hyperintelligent NFC Locker of the Future]]&lt;br /&gt;
* [[S14: Smart Planter]]&lt;br /&gt;
* [[S14: Modular Security System]]&lt;br /&gt;
* [[S14: Autonomous Control System]]&lt;br /&gt;
* [[S14: Anti-Crash Car]]&lt;br /&gt;
* [[S14: Tricopter]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE240 Fall 2013 | Fall 2013]] ===&lt;br /&gt;
&lt;br /&gt;
* [[F13: POV Display]]&lt;br /&gt;
* [[F13: Line Following Robot]]&lt;br /&gt;
* [[F13: LED Display]]&lt;br /&gt;
* [[F13: Bulb Ramper]]&lt;br /&gt;
* [[F13: Garage Parking Assistant]]&lt;br /&gt;
* [[F13: Quadcopter]]&lt;br /&gt;
* [[F13: BarkMaster2000]]&lt;br /&gt;
* [[F13: Remote Control Car]]&lt;br /&gt;
* [[F13: Obstacle Avoidance Robot]]&lt;br /&gt;
* [[F13: Vehicle On Board Diagnostics]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Spring 2013 | Spring 2013]] ===&lt;br /&gt;
&lt;br /&gt;
* [[S13: 2D Plotter]]&lt;br /&gt;
* [[S13: Smart Cube]]&lt;br /&gt;
* [[S13: Garage Parking Aid]]&lt;br /&gt;
* [[S13: Smart Security]]&lt;br /&gt;
* [[S13: Door Alarm System]]&lt;br /&gt;
* [[S13: Solar Panel Tracker]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Fall 2012|Fall 2012]] ===&lt;br /&gt;
&lt;br /&gt;
* [[F12: Evil Watchdog]]&lt;br /&gt;
* [[F12: Smart Bulb]]&lt;br /&gt;
* [[F12: All Your Base are Belong to You]]&lt;br /&gt;
* [[F12: Android Controlled MP3]]&lt;br /&gt;
* [[F12: Unified Wireless Health Monitoring System]]&lt;br /&gt;
* [[F12: OBD-II Android Monitor]]&lt;br /&gt;
* [[F12: Self-Driving GPS Following Car]]&lt;br /&gt;
* [[F12: Android Door Lock]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Spring 2012|Spring 2012]] ===&lt;br /&gt;
*  [[S12: FreeRTOS based QuadCopter]]&lt;br /&gt;
*  [[S12: Web-based MP3 Player]]&lt;br /&gt;
*  [[S12: Self Drive Car]]&lt;br /&gt;
*  [[S12: VAndroid]]&lt;br /&gt;
*  [[S12: Traffic Light Sensing Vehicle]]&lt;br /&gt;
*  [[S12: Sound Reader]]&lt;br /&gt;
*  [[S12: Remote Controlled MP3 Player]]&lt;br /&gt;
*  [[S12: Android Controlled Robot]]&lt;br /&gt;
*  [[S12: Eyes-Free GPS]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Handy References ==&lt;br /&gt;
*  [[Sample Project Report]]&lt;br /&gt;
*  [[Project Proposal Guidelines]]&lt;br /&gt;
*  [[CmpE146 Lab. Resources]]&lt;/div&gt;</summary>
		<author><name>Sree</name></author>	</entry>

	</feed>