Hi Team,
Customer uses simplelink_msp432e4_sdk_4_20_00_12 SDK, and wants to enable telnet function. How to configure the IP, port , etc. ?
Could you help check this case?
Thanks and Regards,
Ben
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.
Hi Team,
Customer uses simplelink_msp432e4_sdk_4_20_00_12 SDK, and wants to enable telnet function. How to configure the IP, port , etc. ?
Could you help check this case?
Thanks and Regards,
Ben
Hi,
We don't have a ready to use telnet example but I find this thread to be helpful on how to set up the telnet for NDK. https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/726448/ccs-msp432e401y-configure-telnet-services-using-udpecho-sample-code-with-static-ip
Hi,
Adding Telnet is quite straight forward but there are a couple of tricks!
I started with the "Portable" sample project for TI RTOS, then added the network stack as in the http demo project. It may be easer to start with a sample project that does use the network, and strip out the bits you don't want. Then just click Telnet in the syscfg gui tool to add the entire implementation.
Add a service report callback function for Telnet - the implementation from httpSrvBasicHooks.c also nicked from the HTTP demo. You may need to edit the name table in the service report function as it may not know about Telnet.
At this point, it should compile and run, but the Telnet service fails to start. you need to swap a library. By default, most samples use netctrl_min_ipv4.aem4f. This minimum version of the library has lots of advanced features - such as Telnet - stripped out. Just remove _min from the name. I found that editing the library name in the CCS project window moved the library to the end of the long list of libraries, and it would not link after that ! Just close CCS, edit the project file with a text editor and re start.
It should now build and run, and report
Service Status: Telnet : Enabled : : 000
I used Putty configured with Connection type Other - Telnet, port 23.
Type a "?" and the Telnet menu appears.
Hope that helps.
Jim
Sorry, forgot your actual questions!
The IP address is the address of the MSP432 board - most projects choose Use DHCP in the "NDK Interface" tab of the sys config tool, but you can pick a fixed IP address there too.
The TCP port for Telnet defaults to 23, but a different value can be selected in the Telnet options tab of sys cfg.
Hi Jim,
How can I get the telnet callback function? Is there any demo?
Thanks
If you mean the service report callback, I just tweaked the one from the other TCP demos:
/** @brief Service report callback.
*
* May be set as the callback for various network config operation that are defined in the GUI.
*/
void serviceReport(uint32_t item, uint32_t status, uint32_t report, void *h)
{
static char *taskName[] = {"Telnet", "", "NAT", "DHCPS", "DHCPC", "DNS"};
static char *reportStr[] = {"", "Running", "Updated", "Complete", "Fault"};
static char *statusStr[] = {"Disabled", "Waiting", "IPTerm", "Failed","Enabled"};
Display_printf(display, 0, 0, "Service Status: %-9s: %-9s: %-9s: %03d\n",
taskName[item - 1], statusStr[status], reportStr[report / 256],
report & 0xFF);
/* report common system issues */
if ((item == CFGITEM_SERVICE_DHCPCLIENT) &&
(status == CIS_SRV_STATUS_ENABLED) &&
(report & NETTOOLS_STAT_FAULT)){
Display_printf(display, 0, 0, "DHCP Client initialization failed; check your network.\n");
while (1);
}
}
Hi Jim,
It seems that the PC can link to device successfully but the device cannot enable Telnet service. I enter ”telnet 192.168.1.100 1000“ in Wndows Terminal like picture_1.
After hitting Enter key, it becoms shown in picture_2.
Throughout the process, I used WireShark tools to capture packets and the result is shown as picture_3. Please help to check it.
My PC IP is 192.168.1.20 and the device IP is 192.168.1.100. The Telnet port number is 1000.
Thanks~
I only ever tried connecting with putty, so I'm not sure.
When you say that the Telnet port is 1000, I assume that means you changed the default from 23 using the Telnet setting in the syscfg GUI!
Should be OK but I only ever used the default.
Have you seen the service report function state that Telnet has started on the Launchpad?
Hi Jim,
I change the Telnet port in a file name tcpEchoHooks.c like below. I don't use syscfg GUI.
There is not any log from the UART console when doing Telnet linking.
Thanks
Ah, I can see why you might expect that to work, however:
Many of the sample projects use netIPAddrHook() to start a network task, with a hard coded port number, when an IP address has first been assigned.
Telnet is a service, so is started differently. When you check Telnet in the syscfg GUI, the following code is added to the generated code file ti_ndk_config.c. Here, the port number (telnet.param.Port = 23;) is generated according to the port parameter from the GUI Telnet settings.
/*
* ======== ti_ndk_config_telnet_init ========
* Configure and initialize Telnet server(s)
*/
extern SOCKET ConsoleOpen(struct sockaddr *pSinClient);static void ti_ndk_config_telnet_init(void *hCfg)
{
CI_SERVICE_TELNET telnet;/* Specify Telnet service for Telnet instance: CONFIG_TELNETS_0 */
/* NOTE! The application must provide the service report function matching this prototype! */extern void serviceReport(uint32_t item, uint32_t status,
uint32_t report, void *h);memset(&telnet, 0, sizeof(telnet));
telnet.cisargs.Mode = CIS_FLG_CALLBYIP;
telnet.cisargs.IPAddr = inet_addr("0.0.0.0");
telnet.cisargs.pCbSrv = serviceReport;
telnet.param.MaxCon = 8;
telnet.param.Port = 23;
telnet.param.Callback = &ConsoleOpen;CfgAddEntry(hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_TELNET, 0, sizeof(telnet), (unsigned char *)&telnet, 0);
}
If you edit this, it will get overwritten but I would recommend sticking with 23, at least until you get something working.
If you have added the service report function to the Telnet setting (like the sample I posted yesterday), you should get some message about Telnet (enabled or failed). Until it reports "enabled", you are not going to be able to connect.
Best regards
Jim
I couldn't see any documentation !
The example uses the library function in C:\ti\simplelink_msp432e4_sdk_4_20_00_12\source\ti\ndk\tools\console\console.c
The top of the function only has a basic comment:
/*--------------------------------------------------------------------- */
/* ConsoleOpen() */
/* Launch a console connection to the specified client */
/* Returns local socket, or INVALID_SOCKET on error */
/*--------------------------------------------------------------------- */
SOCKET ConsoleOpen( struct sockaddr *pClient )
So I think that's it!