Live PhotoFrame Tutorial: Step 4

Step 4.1 - Enable and Configure Camera Driver

In the MPLAB® Harmony Configurator (MHC) Options tab, expand the Harmony Framework Configuration > Drivers > Camera selection tree. Check the Use Camera Driver? box.

use_camera.png

Step 4.2 - Enable and Configure OC Driver

In the MHC Options tab, expand the Harmony Framework Configuration > Drivers > OC selection tree. Check the Use OC Driver? box.

use_oc.png

Configure the OC driver as shown:

oc_configure.png

Configure OC5 in the Pin Manager as shown in the following graphic.

oc_pin_config.png

Step 4.3 - Configure I²C driver

The Camera module is connected to one of the PIC32's I²C ports (I2C3). Configure the I²C driver used by the Camera module.

In the MHC Options tab, expand the Harmony Framework Configuration > Drivers > I2C selection tree. Note when you checked the box beside the Use Camera Driver? selection, MHC automatically checked the Use I2C Driver? box for you. Configure the I²C driver as shown in the following graphic.

i2c_config.png

Verify and Configure the I/O Pins used by the I²C module using the Graphical Pin Manager. Select the Pin Table tab in the Output pane and configure the I²C pins as shown in the following graphic.

i2c_pin_mapping.png

Expand the following section to see descriptions of all I²C driver configuration options.

Step 4.4 - Configure Change Notifications for the Camera module

For the functioning of the camera, Change Notifications has to be enabled for the HREF and VSYNC pins. Also, make sure that the pins connected to the camera are configured as digital pins.

camera_cn_enable.png

Step 4.5 - Configure the pins used by the Camera module

The Board Support Package (BSP) for pic32mz_ef_sk_meb2 will assign some of the pins for accessing the on-board SRAM device. SRAM will be used by the Low-Cost Controllerless (LCC) driver if you configure it to use external memory. In this demo, you will configure the LCC driver to use internal memory.

The pins which are mapped to SRAM are shared with the data lines of the Camera module. So you need to modify the pin mapping to use these pins for the Camera module. If these are not properly mapped, then the Camera module will not work properly. Follow the diagram to map the pins to the Camera module.

camera_pin_mapping.png

Step 4.6 - Timer Driver configuration for the Camera driver

A timer is required for the functioning of the Camera module. Since you already have used the Timer Driver Instance 0 for Timer System Service, you will be using Timer Driver Instance 1 for the Camera module. For Timer Driver Instance 1, you are using Timer module ID 2. Configure the prescale value of the timer to TMR_PRESCALE_VALUE_1.

In the MHC Options tab, expand the Harmony Framework Configuration > Drivers > Timer selection tree. Configure the Timer driver as shown in the following graphic.

timer_configuration.png

Step 4.7 - Configure the peripheral clock for the Camera module

The Camera module uses external interrupt INT2 as its peripheral clock. So, you need to enable the External Interrupt System Service and do the pin mapping for the same in the pin manager.

1

In the MHC Options tab, expand the Harmony Framework Configuration > System Services > Interrupts selection tree. Enable the Use External Interrupts? checkbox.

enable_external_interrupt.png

2

Configure the INT2 to the External Interrupt Instance 0 as shown:

config_external_interrupt.png

3

Assign the pin for the INT2 in the Pin Manager as shown:

pin_map_external_interrupt.png

Step 4.8 - Configure the priorities for Direct Memory Access (DMA) and Change Notification

You need to increase the priorities for the DMA and Change Notifications.

1

In the MHC Options tab, expand the Harmony Framework Configuration > System Services > DMA selection tree.

navigate_dma.png

Increase the interrupt priority of the DMA system service as shown:

dma_change_priority.png

2

In the MHC Options tab, expand the Harmony Framework Configuration > System Services > Ports selection tree.

navigate_ports.png

Increase the interrupt priority of the Ports System Service as shown:

change_ports_priority.png



Next Step >

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.