This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: GPIO control from DSP

Part Number: AM5728

Hi ,

I am in 5728 through ipc and dsp communication, and let dsp control gpio.

I am using a custom board.

My code is based on TI's ex02_messageq and gpio_led_blink.

The following is my core code,

4111.Server.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* ======== Server.c ========
*
*/
/* this define must precede inclusion of any xdc header file */
#define Registry_CURDESC Test__Desc
#define MODULE_NAME "Server"
/* xdctools header files */
#include <xdc/std.h>
#include <xdc/runtime/Assert.h>
#include <xdc/runtime/Diags.h>
#include <xdc/runtime/Log.h>
#include <xdc/runtime/Registry.h>
//C include
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
/* package header files */
#include <ti/ipc/MessageQ.h>
#include <ti/ipc/MultiProc.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
/* local header files */
#include "../shared/AppCommon.h"
/* module header file */
#include "Server.h"
/* GPIO header file */
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_v1.h>
#include <ti/csl/src/ip/gpio/V1/gpio_v2.h>
#include <ti/drv/gpio/src/GPIO_osal.h>
#define NUM_PORTS (8u)
#define NUM_PINS_PER_PORT (32u)
#define CALLBACK_INDEX_NOT_CONFIGURED (0xFFu)
/* Macro to extract GPIO pin number from the gpio pin configuration */
#define GPIO_GET_PIN_NUM(gpioConfig) (((gpioConfig) & GPIO_CFG_PIN_NUM_MASK) >> \
GPIO_CFG_PIN_NUM_SHIFT)
/* Macro to extract GPIO port number from the gpio pin configuration */
#define GPIO_GET_PORT_NUM(gpioConfig) (((gpioConfig) & GPIO_CFG_PORT_NUM_MASK) \
>> GPIO_CFG_PORT_NUM_SHIFT)
/** \brief Mask for all pins of single gpio port */
#define GPIO_PIN_MASK_ALL (0xFFFFFFFFU)
typedef struct GPIO_PortCallbackInfo_s {
/* The port's 8 corresponding user defined pinId indices */
uint8_t pinIndex[NUM_PINS_PER_PORT];
} GPIO_PortCallbackInfo;
/* Table of callbacks per port. */
GPIO_PortCallbackInfo gpioCallbackInfo[NUM_PORTS];
uint32_t portHwiCreatedBitMask = 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

GPIO_v1.h

I had a problem while controlling different gpio.

I tested a lot of gpio and found several problems.

1   I can control gpio4_4, 4_7, 7_7, 7_8, but can't control 4_10, 4_11, 7_10 pins with values greater than 10.

2   When I try to control gpio5 (5-2,5-3,5-10...), the following error occurs.

gpio5-error.txt
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[ 1149.475766] ------------[ cut here ]------------
[ 1149.480422] WARNING: CPU: 1 PID: 27 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x25c/0x36c
*** led0 5 10 0x4805b000 #### 0000 [ 1149.489689] 44000000.ocp:L3 Custom Error: MASTER DSP1_MDMA TARGET L4_PER1_P3 (Idle): Data Acces
s in User mode during Functional access
[ 1149.505131] Modules linked in:
bc_example(O) xhci_plat_hcd xhci_hcd pru_rproc pruss_intc usbcore dwc3 pruss udc_core usb_common sha512_generic sha512_arm sha256_gener
ic rpmsg_proto sha1_generic sha1_arm_neon sha1_arm md5 cbc xfrm_user xfrm4_tunnel ipcomp xfrm_ipcomp esp4 ah4 af_key xfrm_algo rpmsg_rpc
bluetooth snd_soc_simple_card snd_soc_simple_card_utils snd_soc_omap_hdmi_audio pvrsrvkm(O) omap_aes_driver ahci_platform libahci_platf
orm libahci pruss_soc_bus omap_sham libata omap_wdt scsi_mod ti_vpe ti_sc ti_csc ti_vpdma dwc3_omap rtc_omap extcon_palmas extcon_core r
tc_ds1307 rtc_palmas omap_des snd_soc_tlv320aic3x des_generic crypto_engine omap_remoteproc virtio_rpmsg_bus rpmsg_core remoteproc sch_f
q_codel uio_module_drv(O) uio gdbserverproxy(O) cryptodev(O) cmemk(O)
App_exec: message received, sending message 13
[ 1149.573758] CPU: 1 PID: 27 Comm: irq/23-l3-app-i Tainted: G W O 4.9.28-rt16-g786e64041b #23
[ 1149.573760] Hardware name: Generic DRA74X (Flattened Device Tree)
[ 1149.573764] Backtrace:
[ 1149.573778] [<c020b2a8>] (dump_backtrace) from [<c020b564>] (show_stack+0x18/0x1c)
[ 1149.573783] r7:00000009 r6:60000113 r5:00000000 r4:c1024a40
[ 1149.573793] [<c020b54c>] (show_stack) from [<c04d141c>] (dump_stack+0x8c/0xa0)
[ 1149.573801] [<c04d1390>] (dump_stack) from [<c022d880>] (__warn+0xec/0x104)
[ 1149.573806] r7:00000009 r6:c0bbb9c4 r5:00000000 r4:ee625e20
[ 1149.573811] [<c022d794>] (__warn) from [<c022d8d8>] (warn_slowpath_fmt+0x40/0x48)
[ 1149.573817] r9:00000006 r8:ee604b10 r7:c0bbbcb8 r6:00000000 r5:c0bbb8f0 r4:c0bbb994
[ 1149.573826] [<c022d89c>] (warn_slowpath_fmt) from [<c05013ec>] (l3_interrupt_handler+0x25c/0x36c)
[ 1149.573829] r3:ee604980 r2:c0bbb994
[ 1149.573831] r4:80080003
[ 1149.573840] [<c0501190>] (l3_interrupt_handler) from [<c0281c48>] (irq_forced_thread_fn+0x28/0x7c)
[ 1149.573846] r10:c0281c20 r9:ee604e80 r8:ee609000 r7:00000001 r6:00000000 r5:ee609000
[ 1149.573848] r4:ee604e80
[ 1149.573854] [<c0281c20>] (irq_forced_thread_fn) from [<c0281fb0>] (irq_thread+0x124/0x1f8)
[ 1149.573858] r7:00000001 r6:00000000 r5:ee624000 r4:ee604ea4
[ 1149.573865] [<c0281e8c>] (irq_thread) from [<c024ad18>] (kthread+0x100/0x118)
[ 1149.573870] r10:00000000 r9:00000000 r8:c0281e8c r7:ee604e80 r6:ee624000 r5:ee604ec0
[ 1149.573872] r4:00000000
[ 1149.573880] [<c024ac18>] (kthread) from [<c0207c90>] (ret_from_fork+0x14/0x24)
[ 1149.573885] r8:00000000 r7:00000000 r6:00000000 r5:c024ac18 r4:ee604ec0
[ 1149.573887] ---[ end trace 000000000000002c ]---
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

3   When I try to control these gpio 3-29, 4-29, 7-29..., the printed address is incorrect and the value is always changing.

Whether it is 3-29,4-29, the print value is 9514****.

What causes these problems to arise.

Is there a relationship between decimal and hexadecimal conversions?

Or dsp can not control some gpio.

Thanks!