getchar () support (DA14683 / SmartSnippets / UM-B-047 / Blinky

Learn MoreFAQsTutorials

6 posts / 0 new
Last post
ramig972
Offline
Last seen:8 months 1 week ago
Joined:2020-05-06 20:31
getchar () support (DA14683 / SmartSnippets / UM-B-047 / Blinky

Hi,

I have installed

SmartSnippets Studio v.16.3.918

and

SDK (DA1468x_DA15xxx_SDK_1.0.14.1081.zip)

(but not the patch to the SDK)

and run the example described in

User Manual
DA1468x Getting Started with the
Development Kit
UM-B-047

Everything works as detailed in the PDF document

BUT

although printf() works well, getchar() does no work

In the filemain.cin the template in the function

static void system_init( void *pvParameters )

Add after the line

#if defined CONFIG_RETARGET
retarget_init();
#endif

the lines:

printf ("\n>> %s %s %d\n", __FILE__, __FUNCTION__, __LINE__); fflush(stdout);
字符c =获取字符();
printf (" % x % d % c \ n”,c,c,c);fflush(stdout);

The second printf() never happens

I have uploaded the C file in this forum topic by changing its file extenstion from C to PDF (only way to upload)

Your insights are most appriciated.

Best,

Rami

Attachment:
Device:
PM_Dialog
Offline
Last seen:24 min 41 sec ago
Staff
Joined:2018-02-08 11:03
Hi ramig972,

Hi ramig972,

Could you please run it in debug mode and check where it gets stuck? Please share a screenshot..

Unfortunately I am not able to open the attached file. Would it be possible to zip it and attach it again?

Thanks, PM_Dialog

ramig972
Offline
Last seen:8 months 1 week ago
Joined:2020-05-06 20:31
in the file main.c

in the file main.c

function system_init()

添加boldlines :

#if defined CONFIG_RETARGET
retarget_init();
#endif

printf ("\n>> %s %s %d\n", __FILE__, __FUNCTION__, __LINE__); fflush(stdout);
字符c =获取字符();
printf (" % x % d % c \ n”,c,c,c);fflush(stdout);

please share if you see the second printf() statement of the exection steps

PM_Dialog
Offline
Last seen:24 min 41 sec ago
Staff
Joined:2018-02-08 11:03
Hi ramig972,

Hi ramig972,

You should not call this code snippet in system_init() as it will delay the system initialization. Please try to execute it in prvTemplateTask. Probably you might need increase the heap size.

Thanks, PM_Dialog

ramig972
Offline
Last seen:8 months 1 week ago
Joined:2020-05-06 20:31
That was the original code, .

That was the original code, .

I tried again increading the stack size and moving:

/* Start main task here (text menu available via UART1 to control application) */
OS_TASK_CREATE( "Template", /* The text name assigned to the task, for
debug only; not used by the kernel. */
prvTemplateTask, /* The function that implements the task. */
NULL, /* The parameter passed to the task. */
2048,
// 200 * OS_STACK_WORD_SIZE, /* The number of bytes to allocate to the stack of the task. */

mainTEMPLATE_TASK_PRIORITY, /* The priority assigned to the task. */
task_h ); /* The task handle */
OS_ASSERT(task_h);

and

/

static void prvTemplateTask( void *pvParameters )
{
OS_TICK_TIME xNextWakeTime;
static uint32_t test_counter=0;

/* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = OS_GET_TICK_COUNT();

for( ;; ) {

////////////////////////////////////////////////////////////////
printf ("\n\n>>>%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
fflush(stdout);

// Read the next character from the keyboard.
char c = getchar ();
fflush(stdin);

printf (">>>%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
fflush(stdout);
if (isprint((int)c)) {
printf (">>> %c %d %x\n", c,c,c);
} else {
printf (">>> %d %x\n", c,c);
}
fflush(stdout);

//////////////////////////////////////////////////////////////////

Still does not work. only

Getting single printout and the blinky test does not work:

>>>../main.c prvTemplateTask 141

PM_Dialog
Offline
Last seen:24 min 41 sec ago
Staff
Joined:2018-02-08 11:03
Hi ramig972

Hi ramig972

Could you please change the value of the __HEAP_SIZE in the bsp_defaults.h?

Thanks, PM_Dialog