File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ Requirements
1616************
1717
1818The demo assumes that a uCAM-III is connected to the UART_2 TX/RX of a Nucleo
19- L496ZG. Also, the camera module should be powered by the 5V pin.
19+ L496ZG. The RST pin is connected to the PA3 pin of Nucleo. Also, the camera
20+ module should be powered by the 5V pin.
2021
2122Building and Running
2223********************
Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ static int camera_take_snapshot(u8_t *data, u32_t *size)
4444{
4545 int ret ;
4646
47+ /* Hardware reset the camera before every shot */
48+ ucam3_reset ();
49+
4750 /* Synchronize with the camera */
4851 ret = ucam3_sync ();
4952 if (ret ) {
Original file line number Diff line number Diff line change 1010#include <misc/byteorder.h>
1111#include <string.h>
1212#include <stdbool.h>
13+ #include <gpio.h>
1314
1415#define CAM_UART_NAME DT_UART_STM32_USART_2_NAME
1516
@@ -34,6 +35,8 @@ static struct {
3435} cam_data ;
3536
3637static struct tty_serial cam ;
38+ static struct device * reset ;
39+
3740
3841typedef enum {
3942 ACK_INITIAL ,
@@ -107,11 +110,8 @@ static void print_cmd(uint8_t *cmd, int size)
107110
108111void ucam3_reset (void )
109112{
110- uint8_t b ;
111-
112- while (tty_read (& cam , & b , 1 ) > 0 ) {
113- continue ;
114- }
113+ gpio_pin_write (reset , 3 , 0 );
114+ gpio_pin_write (reset , 3 , 1 );
115115}
116116
117117int ucam3_sync (void )
@@ -529,5 +529,13 @@ int ucam3_create(void)
529529 tty_set_rx_buf (& cam , cam_rxbuf , sizeof (cam_rxbuf ));
530530 tty_set_rx_timeout (& cam , 250 );
531531
532+ reset = device_get_binding ("GPIOA" );
533+ if (!reset ) {
534+ return -1 ;
535+ }
536+
537+ gpio_pin_configure (reset , 3 , GPIO_DIR_OUT );
538+ // ucam3_reset();
539+
532540 return 0 ;
533541}
Original file line number Diff line number Diff line change @@ -135,9 +135,9 @@ extern int ucam3_get_picture(u8_t *data, u32_t *size);
135135/**
136136 * @brief Reset the uCAM-III
137137 *
138- * Initialize the serial interface with the camera module.
138+ * Hardware reset the module.
139139 *
140- * @retval 0 on success, otherwise -1
140+ * @retval none
141141 */
142142extern void ucam3_reset (void );
143143
You can’t perform that action at this time.
0 commit comments