send CTRL+Z from UART

Thread Starter

maunik12

Joined Jan 4, 2018
5
Hello All,

I am using Quectel's BG96 module to send data to some cloud services using MQTT Protocol.
'Quectel_BG96_MQTT_Application_Note_V1.0' is documented well and I am following the same.
According to its section 3.2.8, we need to send CTRL+Z, to send user data to cloud, once ">" is responded from the module.

While using QNavigator (Quectel's AT Command tester) I follow the same procedure and I can publish my data to the cloud service.

The problem is that I don't know how to send CTRL+Z via UART, specifically in this case.
Can any one help me out here?

Suppose I want to publish "Quectel" on a cloud, how should I embed CTRL+Z with the string "Quectel" in my UART Transmission code?

Thanks & Regards,
Maunik Patel
 

WBahn

Joined Mar 31, 2012
30,088
Hello All,

I am using Quectel's BG96 module to send data to some cloud services using MQTT Protocol.
'Quectel_BG96_MQTT_Application_Note_V1.0' is documented well and I am following the same.
According to its section 3.2.8, we need to send CTRL+Z, to send user data to cloud, once ">" is responded from the module.

While using QNavigator (Quectel's AT Command tester) I follow the same procedure and I can publish my data to the cloud service.

The problem is that I don't know how to send CTRL+Z via UART, specifically in this case.
Can any one help me out here?

Suppose I want to publish "Quectel" on a cloud, how should I embed CTRL+Z with the string "Quectel" in my UART Transmission code?

Thanks & Regards,
Maunik Patel
The "control codes" are the first 32 ASCII codes, so they are the lower 5 bits of the 7-bit ASCII sequence.

Since they couldn't be typed directly from a terminal keyboard and it was sometimes desired to do so, a key was added to the keyboard that suppressed the upper two bits. Not surprisingly, this was called the "control" key.

Since Z has an ASCII value of 0x5A (01011010), suppressing the upper two bits yields (00011010) or 0x1A. In decimal, this is 26.
 

Thread Starter

maunik12

Joined Jan 4, 2018
5
Hello @MaxHeadRoom and @WBahn,

Thank you for your valuable time.

uint8_t ctrl_z = 0x1A; //'0x1A', 26, '26';

char msg[] = {'0x41','0x42','0x43','0x1A'};
char msg[] = {'65', '66', '67','26'};

HAL_UART_Transmit_IT(&huart1,(uint8_t *)msg, sizeof(msg));
HAL_UART_Transmit_IT(&huart1, &ctrl_z, sizeof(ctrl_z));
 

Thread Starter

maunik12

Joined Jan 4, 2018
5
Hello @MaxHeadRoom and @WBahn,

Thank you for your valuable time.
Description given by WBahn is something, which I have never found on internet. Very well @WBahn

Please ignore my previous reply. It was sent by mistake.

Yes, I know that CTRL+Z = 26(DEC), 0x1A(Hex), but I don't know exactly how to send it.
Look at a copy of my code below.

uint8_t ctrl_z = 26; // '26', 0x1A, '0x1A' (I have tried these 3 options also)
char msg[] = "Quectel";


HAL_UART_Transmit_IT(&huart1,(uint8_t *)msg, sizeof(msg));
HAL_UART_Transmit_IT(&huart1, &ctrl_z, sizeof(ctrl_z));

Here, I tried sending CTRL+Z in above mentioned 4 ways.
Some how, I can't Publish my data.

The APIs used for transmission are for STM32L4 series controller.

Feel free if you need some more details from my side.

Thanks & Regards,
Maunik Patel
 

MaxHeadRoom

Joined Jul 18, 2013
28,703
I only program in Assembly but all that should be needed is to transmit via the USART register by loading the hex value 0x1A.
Max.
 

Picbuster

Joined Dec 2, 2013
1,047
try to connect a terminal emulator (show hex value on screen) on a separate pc to the uart output from your hardware.

Look at the output and check if hex 1A is received.
if not problem in your mechanism.
if received look at receiver part; how did you respond after the prompt to early or to late.
did you generate the correct headers?
what error code is generated by the cloud?
see: http://mqtt.org/new/wp-content/uploads/2009/06/MQTT-SN_spec_v1.2.pdf

Picbuster
 
Top