Problem for restoring shell [SOLVED]

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Post Reply
geoffroy
Posts: 7
Joined: Fri Oct 30, 2015 3:28 pm

Problem for restoring shell [SOLVED]

Post by geoffroy »

Hi Giovanni,

I need to close the shell interface temporary and restore it later, because I need to use USART 1 (used by the shell) with another peripheral during a short delay.
Here is what I do actually :

1. I close the shell from a command, ie:

Code: Select all

static void cmd_exit_shell(BaseSequentialStream *chp, int argc, char *argv[]) //called by the shell thread
{
        sdStop(&SHELL_SD);  //stop serial driver used by the shell

        // ..here I modify its configuration and restart it

        shellExit(0);   //Finally, I exit shell. method is blocking. cf doc.
}


2. When I have done my jobs, I need to restore the shell, so I do this :

Code: Select all

sdStop(&SHELL_SD);
sdStart(&SHELL_SD, &shellSerialConfig);
shellInit();
shellThread = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO); // something is wrong here, shellThread is null


But my shell is not restarted, I cannot reach my prompt like before ..
Do I something wrong ?
What is the correct way to achieve this ?

Thanks in advance :) ,

Geoffroy
Last edited by geoffroy on Thu Feb 11, 2016 4:59 pm, edited 1 time in total.
geoffroy
Posts: 7
Joined: Fri Oct 30, 2015 3:28 pm

Re: Problem for restoring shell

Post by geoffroy »

Ok, It seems that it was a memory allocation problem ;-)
I add this and everything is working :

Code: Select all

   if(shellThread) {
      chThdRelease(shellThread);
   }
Post Reply