sim900 echoes to micro but does not do anything - c

I have got a sim900 module which has a rs232 serial port. when I connect it
to my computer it works fine on a terminal but when I connect it to an atmega16 micro controller it only echoes back what ever I send to it and does not answer to commands.
besides i use a max232 ic to convert rs232 to ttl.
#include <io.h>
#include <mega16a.h>
#include <alcd.h>
#include <delay.h>
#include <stdio.h>
interrupt [USART_RXC] void usart_rx_isr(void)
{
char status,data;
status=UCSRA;
data=UDR;
if(data!=0xd && data!= 0xa)lcd_putchar(data);
}
void main(void)
{
////////////////////////I/O REGISTERS
DDRB = 1 << DDB0;
///////////////////////USART REGISTERS
UCSRA=(0<<RXC) | (0<<TXC) | (0<<UDRE) | (0<<FE) | (0<<DOR) | (0<<UPE) | (0<<U2X) | (0<<MPCM);
UCSRB=(1<<RXCIE) | (0<<TXCIE) | (0<<UDRIE) | (1<<RXEN) | (1<<TXEN) | (0<<UCSZ2) | (0<<RXB8) | (0<<TXB8);
UCSRC=(1<<URSEL) | (0<<UMSEL) | (0<<UPM1) | (0<<UPM0) | (0<<USBS) | (1<<UCSZ1) | (1<<UCSZ0) | (0<<UCPOL);
UBRRH=0x00;
UBRRL=0x33;
///////////////////////ENABLE GLOBAL INTERUPTS
#asm("sei")
///////////////////////LCD CONFIGURATION
lcd_init(16);
lcd_gotoxy(0,0);
delay_ms(2000);
printf("ATE0\r\n");
delay_ms(2000);
printf("ATD+989190077175;\r\n");
delay_ms(20000);
while (1)
{
lcd_clear();
lcd_gotoxy(0,0);
// Please write your application code here
printf("AT\r\n");
delay_ms(2000);
}
}

You are obviously not talking to your SIM900.
The command "ATE0" you are issuing, is supposed to make SIM900 to switch the echo off. So, after that command you can't see echo from SIM.
Given the information you have provided I could suggest the following:
Check your max232 schematics. The easiest case here is the you have somehow Rx/Tx connected, which would explain both - you seeing the echo and not communicating with SIM. To troubleshoot that - just connect your max232 to the computer with serial terminal program and on the output side of the converter connect Rx/Tx. You should see the echo. Then disconnect them - you should not see the echo.
General suggestion - this is not the exactly the right place for such discussions. That's more Question/Answer knowledgebase.

Related

How to run FreeRTOS on TM4C129EXL? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I am working on a C project for the university where a CoAP server is to be hosted on a TM4C129EXL. It is particularly important to choose a FreeRTOS operating system. Unfortunately, I had to learn that Texas Instruments has stopped supporting FreeRTOS. There are no options for me to switch to another operating system. It is for this reason that I turn to you.
I'm looking for a sample program in which Free RTOS is executed on a TM4C129EXL board. In the best case, I would be happy about a Code Composer Studio Project, as this is the IDE we work with from the university.
If you do not have any sample code available, I would be happy to receive any other information regarding FreeRTOS and CoAP of course with reference to the TM4C129EXL.
You did not specify if you had any requirements in terms of FreeRTOS version, but you can either:
use the demo provided in file SW-EK-TM4C1294XL-2.1.4.178.exe available on TI WEB site as is - you will find it in directory examples\boards\ek-tm4c1294xl-boostxl-senshub\senshub_iot
use this example as a basis to use a more recent version of FreeRTOS: you just would have to replace FreeRTOS source code by the most recent one, and maybe to modify some code in the demo: some function names/signatures may have changed across major versions.
The procedure hereafter describes step by step how to create a minimalist FreeRTOS program with Code Composer Studio 10.3.0 and FreeRTOS v202104.00 in a Windows 10 environment using the second approach. You may have to adjust the drive letter to you specific setup, I am using D: for the purpose of this example..
Download Code Composer Studio 10.3.0, FreeRTOS v202104.00 and SW-EK-TM4C1294XL-2.1.4.178.exe.
Install Code Composer Studio with support for the Tiva-C MCU familly. When prompted for a workspace name, specify D:\ti\workspace_v10.
Unzip FreeRTOSv202104.00.zipinto D:\.
Unzip SW-EK-TM4C1294XL-2.1.4.178.exe into D:\SW-EK-TM4C1294XL-2.1.4.178.
Launch CCS
Use the menu item File/New/CCS Project, and create an 'Empty Project (with main.c).
[]
Click on the Finishbutton.
Create the following directories: D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\driverlib D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\inc D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\include D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\GCC D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\GCC\ARM_CM4F D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\MemMang
Copy D:\SW-EK-TM4C1294XL-2.1.4.178\examples\boards\ek-tm4c1294xl-boostxl-senshub\senshub_iot\FreeRTOSConfig.h into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS
Copy all .h files from D:\SW-EK-TM4C1294XL-2.1.4.178\driverlib into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\driverlib.
Copy D:\SW-EK-TM4C1294XL-2.1.4.178\driverlib\gcc\libdriver.a into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\driverlib.
Copy all .hfiles from D:\SW-EK-TM4C1294XL-2.1.4.178\inc into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\inc.
Copy all files present in D:\FreeRTOSv202104.00\FreeRTOS\Source\include into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\include.
Copy all .cfiles present in D:\FreeRTOSv202104.00\FreeRTOS\Source into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel.
Copy all file present in D:\FreeRTOSv202104.00\FreeRTOS\Source\portable\GCC\ARM_CM4F into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\GCC\ARM_CM4F
Copy D:\FreeRTOSv202104.00\FreeRTOS\Source\portable\MemMang\heap_4.c into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\MemMang.
Edit D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\main.c, and replace its content by:
#include "FreeRTOS.h"
#include "task.h"
extern void prvSetupHardware();
extern void main_blinky();
int main(void)
{
/* Configure the hardware ready to run the demo. */
prvSetupHardware();
main_blinky();
/* Don't expect to reach here. */
return 0;
}
void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName)
{
while(1)
{
}
}
Create a new file named D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\blinky.c with the following content:
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "FreeRTOS.h"
#include "task.h"
#include "sysctl.h"
static void prvLedToggleTask();
/* Priorities at which the tasks are created. */
#define mainTOGGLE_LED_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define TOGGLE_LED_DELAY_MS 200
void main_blinky()
{
/* create task */
xTaskCreate( prvLedToggleTask, "LED", configMINIMAL_STACK_SIZE, NULL, mainTOGGLE_LED_PRIORITY, NULL );
/* Start the tasks and timer running. */
vTaskStartScheduler();
}
static void prvLedToggleTask( void *pvParameters )
{
// Remove compiler warning about unused parameter. */
( void ) pvParameters;
for( ;; )
{
//
// Turn on the LED.
//
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0);
// Wait a bit
vTaskDelay( TOGGLE_LED_DELAY_MS);
//
// Turn off the LED.
//
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x0);
// Wait a bit
vTaskDelay( TOGGLE_LED_DELAY_MS );
}
}
uint32_t g_ui32SysClock;
void prvSetupHardware()
{
// Configure PLL
g_ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
//
// Enable the GPIO port that is used for the on-board LED.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
//
// Check if the peripheral access is enabled.
//
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPION))
{
}
//
// Enable the GPIO pin for the LED (PN0). Set the direction as output, and
// enable the GPIO pin for digital function.
//
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
}
Edit tm4c1294ncpdt_startup_ccs_gcc.c: add the following lines after the line containing static void IntDefaultHandler(void);
extern void xPortPendSVHandler(void);
extern void vPortSVCHandler(void);
extern void xPortSysTickHandler(void);
The resulting code should look like:
void ResetISR(void);
static void NmiSR(void);
static void FaultISR(void);
static void IntDefaultHandler(void);
extern void xPortPendSVHandler(void);
extern void vPortSVCHandler(void);
extern void xPortSysTickHandler(void);
Edit tm4c1294ncpdt_startup_ccs_gcc.c: replace the default interrupt handler by the FreeRTOS one in array g_pfnVectors[].
Original code:
void (* const g_pfnVectors[])(void) =
{
(void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)),
// The initial stack pointer
ResetISR, // The reset handler
NmiSR, // The NMI handler
FaultISR, // The hard fault handler
IntDefaultHandler, // The MPU fault handler
IntDefaultHandler, // The bus fault handler
IntDefaultHandler, // The usage fault handler
0, // Reserved
0, // Reserved
0, // Reserved
0, // Reserved
IntDefaultHandler, // SVCall handler
IntDefaultHandler, // Debug monitor handler
0, // Reserved
IntDefaultHandler, // The PendSV handler
IntDefaultHandler, // The SysTick handler
Resulting code:
void (* const g_pfnVectors[])(void) =
{
(void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)),
// The initial stack pointer
ResetISR, // The reset handler
NmiSR, // The NMI handler
FaultISR, // The hard fault handler
IntDefaultHandler, // The MPU fault handler
IntDefaultHandler, // The bus fault handler
IntDefaultHandler, // The usage fault handler
0, // Reserved
0, // Reserved
0, // Reserved
0, // Reserved
vPortSVCHandler, // SVCall handler
IntDefaultHandler, // Debug monitor handler
0, // Reserved
xPortPendSVHandler, // The PendSV handler
xPortSysTickHandler, // The SysTick handler
Edit the project properties for the GCC Compiler directories, and add the following directories: ${workspace_loc:/${ProjName}/FreeRTOS-Kernel/include} ${workspace_loc:/${ProjName}/FreeRTOS-Kernel/portable/GCC/ARM_CM4F} ${workspace_loc:/${ProjName} ${workspace_loc:/${ProjName}/driverlib} and click on the Apply and close button.
Edit D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOSConfig.h and delete the following lines:
#define configGENERATE_RUN_TIME_STATS 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() \
g_vulRunTimeStatsCountValue = 0ul
#define portGET_RUN_TIME_COUNTER_VALUE() g_vulRunTimeStatsCountValue
Edit the GCC compiler Command-line pattern and add the -mfloat-abi=hard option after ${flags} in the Command-line pattern:
${command} ${flags} -mfloat-abi=hard ${output_flag}${output} ${inputs}
Edit the GNU Linker Command-line pattern and add the -mfloat-abi=hard option after ${flags}:>br/>
${command} ${flags} -mfloat-abi=hard ${output_flag}${output} ${inputs}
Edit the GCC Linker libraries: add libdriver.a to the -l option, and ${workspace_loc:/${ProjName}/driverlib} to the -L option, then click on the Apply and close button.
Build your project - it should build without any errors.
Flash your project by running it.
In my case, I had to stop the project and to press the board resetbutton in order to the program to start.
Finally, the LED should start blinking every 200ms.
The complete list of files in the project once the project 'cleaned' should ultimately be:
Folder PATH listing for volume DATA
Volume serial number is 0E12-BCA2
D:.
| .ccsproject
| .cproject
| .project
| blinky.c
| FreeRTOSConfig.h
| main.c
| tm4c1294ncpdt.lds
| tm4c1294ncpdt_startup_ccs_gcc.c
|
+---.settings
| org.eclipse.cdt.codan.core.prefs
| org.eclipse.cdt.debug.core.prefs
| org.eclipse.core.resources.prefs
|
+---Debug
| | ccsObjs.opt
| | makefile
| | objects.mk
| | sources.mk
| | subdir_rules.mk
| | subdir_vars.mk
| | TM4C129EXL-FreeRTOS.map
| |
| +---driverlib
| | subdir_rules.mk
| | subdir_vars.mk
| |
| \---FreeRTOS-Kernel
| | subdir_rules.mk
| | subdir_vars.mk
| |
| \---portable
| +---GCC
| | \---ARM_CM4F
| | subdir_rules.mk
| | subdir_vars.mk
| |
| \---MemMang
| subdir_rules.mk
| subdir_vars.mk
|
+---driverlib
| adc.h
| aes.h
| can.h
| comp.h
| cpu.h
| crc.h
| debug.h
| des.h
| eeprom.h
| emac.h
| epi.h
| flash.h
| fpu.h
| gpio.h
| hibernate.h
| i2c.h
| interrupt.h
| lcd.h
| libdriver.a
| mpu.h
| onewire.h
| pin_map.h
| pwm.h
| qei.h
| rom.h
| rom_map.h
| rtos_bindings.h
| shamd5.h
| ssi.h
| sw_crc.h
| sysctl.h
| sysexc.h
| systick.h
| timer.h
| uart.h
| udma.h
| usb.h
| watchdog.h
|
+---FreeRTOS-Kernel
| | croutine.c
| | event_groups.c
| | list.c
| | queue.c
| | stream_buffer.c
| | tasks.c
| | timers.c
| |
| +---include
| | atomic.h
| | croutine.h
| | deprecated_definitions.h
| | event_groups.h
| | FreeRTOS.h
| | list.h
| | message_buffer.h
| | mpu_prototypes.h
| | mpu_wrappers.h
| | portable.h
| | projdefs.h
| | queue.h
| | semphr.h
| | StackMacros.h
| | stack_macros.h
| | stdint.readme
| | stream_buffer.h
| | task.h
| | timers.h
| |
| \---portable
| +---GCC
| | \---ARM_CM4F
| | port.c
| | portmacro.h
| |
| \---MemMang
| heap_4.c
|
\---inc
asmdefs.h
hw_adc.h
hw_aes.h
hw_can.h
hw_ccm.h
hw_comp.h
hw_des.h
hw_eeprom.h
hw_emac.h
hw_epi.h
hw_fan.h
hw_flash.h
hw_gpio.h
hw_hibernate.h
hw_i2c.h
hw_ints.h
hw_lcd.h
hw_memmap.h
hw_nvic.h
hw_onewire.h
hw_pwm.h
hw_qei.h
hw_shamd5.h
hw_ssi.h
hw_sysctl.h
hw_sysexc.h
hw_timer.h
hw_types.h
hw_uart.h
hw_udma.h
hw_usb.h
hw_watchdog.h
tm4c1294ncpdt.h

Can't access gpio line with gpiod_line_request_output() on Adafruit FT232H

I am using an Adafruit Ft232H breakout to add GPIO ports to my Linux pc. Although I had some success to flash a led with libftdi and bitbang mode, I don't have the same luck with libgpiod because gpiod_line_request_output is failing.
Some gpio information of my system:
sudo gpiodetect
gpiochip0 [ftdi-cbus] (4 lines)
sudo gpioinfo
gpiochip0 - 4 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
This is the C program which tries to access the line 0.
#include <stdio.h>
#include <stdlib.h>
#include <gpiod.h>
#define LINE_NUM 0
void gpio_fatal(struct gpiod_chip* chip, const char msg[20]);
int main(int argc, char** argv)
{
struct gpiod_chip* chip;
struct gpiod_line* line;
const char path[] = "/dev/gpiochip0";
chip = gpiod_chip_open(path);
if(!chip)
{
fprintf(stderr, "Error opening path\n");
return EXIT_FAILURE;
}
line = gpiod_chip_get_line(chip, LINE_NUM);
if(!line)
{
fprintf(stderr, "error getting this line\n");
return EXIT_FAILURE;
}
int ret = gpiod_line_request_output(line,
"ftdi-cbus",
1);
if(ret != 0)
gpio_fatal(chip, "Request output failed");
for(;;)
{
gpiod_line_set_value(line, 1);
printf("On\n");
sleep(1);
gpiod_line_set_value(line, 0);
printf("Off\n");
sleep(1);
}
gpiod_line_release(line);
gpiod_chip_close(chip);
return EXIT_SUCCESS;
}
void gpio_fatal(struct gpiod_chip* chip, const char* msg)
{
fprintf(stderr, "%s\n", msg);
gpiod_chip_close(chip);
exit(EXIT_FAILURE);
}
Running the executable with sudo gives me:
sudo g_gpiod/build/g_gpiod
Password:
Request output failed
gpiod.h states for the failing function the following:
/**
* #brief Reserve a single line, set the direction to output.
* #param line GPIO line object.
* #param consumer Name of the consumer.
* #param default_val Initial line value.
* #return 0 if the line was properly reserved, -1 on failure.
*/
int gpiod_line_request_output(struct gpiod_line *line,
const char *consumer, int default_val) GPIOD_API;
The parameters seem to be correct, for what reason could this be failing? Other examples using libftdi or CircuitPython can access the ports and work correctly.
You need to flash the EEPROM to set the function of pin C5, e.g. using the ftdi_eeprom command from libftdi. First, unload the ftdi_sio module and save the original EEPROM:
$ sudo rmmod ftdi_sio
$ sudo ftdi_eeprom --verbose --device i:0x0403:0x6014 ft232h-orig.conf
FTDI eeprom generator v0.17
(c) Intra2net AG and the libftdi developers <opensource#intra2net.com>
FTDI read eeprom: 0
EEPROM size: 256
VID: 0x0403
PID: 0x6014
Release: 0x0900
Bus Powered: 100 mA
Manufacturer: ÿÿÿÿÿÿÿÿ
Product: ÿÿÿÿÿÿ
Serial: ÿÿÿÿÿÿÿÿ
Checksum : ffff
PNP: 1
Channel A has Mode UART
FT1284 Mode Clock is idle LOW, MSB first, No Flow Control
ACBUS has 4 mA drive
ADBUS has 4 mA drive
C0 Function: TRISTATE
C1 Function: TRISTATE
C2 Function: TRISTATE
C3 Function: TRISTATE
C4 Function: TRISTATE
C5 Function: TRISTATE
C6 Function: TRISTATE
C7 Function: TRISTATE
C8 Function: DRIVE_1
C9 Function: DRIVE_0
FTDI close: 0
The file ft232h-orig.conf contains just a single line filename="ft232h-orig.bin".
You can control 4 GPIO pins of the FT232H using the ftdi_sio module:
| line | pin | remarks |
==========================
| 0 | C5 | - |
| 1 | C6 | - |
| 2 | C8 | red led |
| 3 | C9 | green led |
The Adafruit board has the cathodes of two LEDs (red and green) connected to pins C8 and C9. The default EEPROM has C9 set to DRIVE_0 so that the green LED is "on" when the board is powered up.
Here is my config file for ftdi_eeprom:
$ cat ft232h-libgpiod.conf
vendor_id="0x0403"
product_id="0x6014"
manufacturer="Adafruit"
product="FT232H Breakout"
# whatever
serial="20211223"
use_serial=true
max_power=100
self_powered=false
remote_wakeup=false
cha_type=UART
cha_vcp=false
cbush5=IOMODE
cbush6=IOMODE
# red led
cbush8=IOMODE
# green led
cbush9=DRIVE_0 # power-on indicator
#cbush9=IOMODE
$ sudo ftdi_eeprom --verbose --device i:0x0403:0x6014 --flash-eeprom ft232h-libgpiod.conf
Your program now works fine with line 0 on pin C5. As a bonus, you can now control the red LED with the libgpiod commands:
# turn red LED on (low active)
sudo gpioset gpiochip0 2=0

ATSAMD51G19 Help setting up Digital output with clock source

I cant seem to get my head round configuring the internal clock as an output.
I'm looking to output a 32MHz clock on PA22 or Digital Pin 1 on the adafruit metro M4 Express.
here is my code
void setup()
{
GCLK->GENCTRL[7].reg = GCLK_GENCTRL_OE | // Enable the GCLK output
GCLK_GENCTRL_IDC | // Set the duty cycle to 50/50 HIGH/LOW
GCLK_GENCTRL_GENEN |
GCLK_GENCTRL_SRC_DFLL;
while(GCLK->SYNCBUSY.bit.GENCTRL7);
PORT->Group[g_APinDescription[1].ulPort].PINCFG[g_APinDescription[1].ulPin].bit.PMUXEN = 1;
PORT->Group[g_APinDescription[1].ulPort].PMUX[g_APinDescription[1].ulPin >> 1].reg |= PORT_PMUX_PMUXO(1);
}
any help much appreciated

Programming e-ink display on atmega32 without arduino

i've bought eink 1,54 display module from waveshare, i want to program atmega32 and design a gui with keys on this eink. I wrote a simple code using spi in eclipse:
#include <avr/io.h>
#include <util/delay.h>
void Inicjacja_spi()
{
DDRB = ( 1 << PB5 ) | ( 1 << PB7 ) | ( 1 << PB4 );
SPCR = ( 1 << SPE ) | ( 1 << MSTR ) | (1<<SPI2X) |( 1 << SPR1 ) | ( 1 << SPR0 );
}
void Wyslij_spi(unsigned char bajt)
{
SPDR = bajt;
while( ! bit_is_set( SPSR, SPIF ) );
}
int main()
{
unsigned char bajt[] = {0x04,0x20,0x21,0x22,0x25,0x26,0x27};
Inicjacja_spi();
for(int i=0; i<8; i++)
Wyslij_spi(bajt[i]);
while(1)
{
}
}
I have read about how to send commands through spi to this eink but it didnt work. Do i have to write complicated libraries to send some data into display? I guess it should work using simple commands, but maybe i'am doing somethin wrong. If someone can tell me how can i write simple commands into this thing because i dont understand those documentations. Simple working example should help me.
I'd start with the display manufacturers documentation first.
Typically these devices need specific drivers and the manufacturer supplies these along with some example code.
The displays themselves normally require some driver hardware, is this included in or with your display module?
I'm sorry but as you don't give any information regarding the display other than where you bought it from and its size I can't be more specific.
edit
Just had a very quick scan through and see that there's a link to a library written to drive these using SPI - Library source on GIT hub
You may be able to adapt it, or glean something useful from the source code.

serial data truncated by termios on embedded device

I am working on a C program listening to the serial port running on an ARM Linux embedded device.
Other sets of data work fine, but always when I send a particular set of data, the beginning of the set is truncated. What is truncated is the following (slsniff program output running on the target):
Device --> ^ (094) { (123) <STX> (002) <BS> (008) <STX> (002) <NUL> (000) <NUL> (000) <STX> (002) <SOH> (001) <ETX> (003)
I have debugged enough to be fairly certain this is caused by some termios constant, which is using the end of text ETX to truncate.
Right now I am down to:
struct termios t;
t.c_lflag &= ~(ICANON | IEXTEN | ECHO);
t.c_iflag &= ~ICRNL;
t.c_cc[VMIN] = 1; /* Character-at-a-time input */
t.c_cc[VTIME] = 0; /* with blocking */
The set separator character is a CR 0x0d, that seems to work fine in all cases.
Any help greatly appreciated.
Best regards,
Bert
Answer was:
cfmakeraw as explained at http://linux.die.net/man/3/termios

Resources