In BG96 AT driver, the socket read always returns whole received data, and the will cause an issue like below. The TLS layer asks only 5 bytes, but the driver returns whole 1500 bytes back.
+QIURC: "recv",0
AT+QIRD=0
+QIRD: 1500
[22][3][3]A[2][0][0]Q[3][3][171][135]o[24][196][173][188][141]_[234][164]Q:R[242]5[153]CP)[242]R[222][251][176][208][0][193]t}[146][238] [185][148]l[205]L[228][3][14][162][213][21][162]0[143]U[229][228][202][9][208]s[144][242]K[239][14]/[210][189][174][25][233][192],[0][0][9]..[0]K
ssl_tls.c:2885: |2| in_left: 0, nb_want: 5
ssl_tls.c:2887: |2| ssl->f_recv(_timeout)() returned 1500 (-0xfffffa24)
ssl_tls.c:2897: |1| f_recv returned 1500 bytes but only 5 were requested
Mbed supports several CAT-M1/NB1 targets now, only BG96 has such issue, other targets like BC95, UBLOX and CINTERION are OK. The BG96 AT command supports partial read feature, so it should be a driver issue.
[ ] Question
[ ] Enhancement
[X] Bug
Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-416
Indeed BG96 cellular driver misses to provide the required size to AT+QIRD command, in TCP case. We will fix it. Thanks for bringing this up!
Except to provide the required size to AT+QIRD command, please also add the size limitation of AT+QISEND and AT+QIRD command. In AT + QISEND, the maximum data length is 1460 bytes. And in AT + QIRD, the maximum data length is 1500 bytes.
Will check them all.
You can also issue a pull request with your findings if you wish.
@ccchang12 Could you verify is this fixed? And close if ok.
It works well, thank you.