zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
11k stars 6.69k forks source link

AIO doesn't work on QUARK_D2000_CRB #1738

Closed zephyrbot closed 8 years ago

zephyrbot commented 8 years ago

Reported by Lei Liu:

==========

x86 quark D2000 CRB nano Bug detailed description =================== AIO shim doesn't work ================== 1. cd zephyr/samples/drivers/aio_dw_comparator 2. Chang AIN index num in src/main.c {code:title= AIN |borderStyle=solid} struct cb_data_t cb_data = { .ain_idx = 3, .ref = AIO_CMP_REF_A, .pol = AIO_CMP_POL_RISE, .name = "A3, AIN[10]", }; {code} 3. Add pinmux function in src/main.c. {code:title= AIN |borderStyle=solid} pinmux_dev = device_get_binding("pinmux"); if ( !pinmux_dev ) { PRINT("Error, Get pinmux failed\n"); PRINT("result: FAIL\n"); return; } ret = pinmux_pin_set(pinmux_dev, 3, PINMUX_FUNC_B); if ( ret != DEV_OK ) { PRINT("Error, set pinmux failed\n"); PRINT("result: FAIL\n"); return; } {code} 4. Build image basing on QMSI lib. 5. Connect the A3 pin to ground via a resistor. Any larger than 1k Ohm would be fine. This is to avoid floating pin. 6. Turn on the device. 7. Wait for device to boot, until "app started" line appeared. 8. Connect a voltage source higher than 3.3V (the 5V line would work).The line "*** A3, AIN[3] triggered rising." should appear. 9. Remove the voltage source.The line "*** A3, AIN[3] triggered falling." should appear. Expected Result ============= AIO works. Serial output message like above description. Actual Result ========== AIO doesn't work. (Imported from Jira ZEP-163)
zephyrbot commented 8 years ago

by Sergio Rodriguez:

zephyrbot commented 8 years ago

by Sergio Rodriguez:

zephyrbot commented 8 years ago

by Sergio Rodriguez:

First I think the actual pinmux for pin 3 is AI0 according to the schematic and the pinmux file in drivers/pinmux/quark_mcu/pinmux_board_quark_d2000_crb.c, pin 3 is

/ pin, ball, mode A, mode B, mode C / / 3 F03, gpio_3, ai_3, spi_m_ss3 /

and by default is slected as Analog IO and looking at the schematic that pin is A0 in the 6 pin header of the analog IO just double check if that is the case

Second, a lots of printing on the ISR so that might overflow the stack and cause some corruption can you add the following line to your prj,conf? CONFIG_ISR_STACK_SIZE=512

Let me know if it works

zephyrbot commented 8 years ago

by Kuo-Lang Tseng:

Lei, any update on this?

zephyrbot commented 8 years ago

by Lei Liu:

I tried A0 on the CRB board & tried your config. AIO still doesn't work.

zephyrbot commented 8 years ago

by Sergio Rodriguez:

Ok I will take a look right now

zephyrbot commented 8 years ago

by Sergio Rodriguez:

I tried my test case, on zepyr with the tag v1.3.0-rc2, I connected the pin marked A0 from analog input 6-header to a pull down resistor and a push switch connected to the 3.3 v , run my test case and use the switch to issue the voltage changes, and it works for me, here is my test case [^aio.tar.gz]

zephyrbot commented 8 years ago

by Lei Liu:

I tried you test case. Still doesn't work on my side. {code:title=test app output |borderStyle=solid} ===== app started ======== ... waiting for event! (1) (0) ... waiting for event! (2) (0) ... waiting for event! (3) (0) ... waiting for event! (4) (0) ... waiting for event! (5) (0) ... waiting for event! (6) (0) ... waiting for event! (7) (0)

{code}

zephyrbot commented 8 years ago

by Lei Liu:

Thanks Sergio Rodriguez , AIO worked on v1.3.0-rc2. But v1.3.0 doesn't work. I'll post first bad commit, later

zephyrbot commented 8 years ago

by Lei Liu:

This is the first bad commit {code:title=First bad commit |borderStyle=solid} commit 1d547699a5ddd1c86ee2b561a66975bbfffa8264 Author: Anas Nashif anas.nashif@intel.com AuthorDate: Sat May 7 12:06:09 2016 -0400 Commit: Anas Nashif nashif@linux.intel.com CommitDate: Thu May 12 10:57:24 2016 +0000

aio: unify kconfig variables and make them consistent

Change-Id: Ic3e4f1142a3d4dcde5947586bb4ad86372b3f70b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>

{code}

zephyrbot commented 8 years ago

by Sharron LIU:

Sergio Rodriguez , there're Kconfig changes in the above commit. Could you share an updated working sample taking those new Kconfigs? Thanks.

zephyrbot commented 8 years ago

by Sergio Rodriguez:

Here the problem was the device name changed on the test case here is the code for the [^aio_qmsi.tar.gz] test case, this was tested on top of the tree at the time of the message

zephyrbot commented 8 years ago

by Kuo-Lang Tseng:

Test code is to be updated.

zephyrbot commented 8 years ago

by Mark Linkmeyer:

Closed since the Reporter verified it.

zephyrbot commented 7 years ago

by Mark Linkmeyer:

Correcting the priority field