Closed ph1lj-6321 closed 2 years ago
Hi,
To receipt any data you need to check if there is any data received by eth.GetRxPacketCnt()
. Then read a data by rxLen = eth.ReceivePacket(rxBuf)
to prealocated buffer rxBuf
. Return value rxLen
gives you information how many bytes was exactly received or an error code (negative number).
# prealocate buffer
rxBuf = bytearray(enc28j60.ENC28J60_ETH_RX_BUFFER_SIZE)
# check if any packet is received
while eth.GetRxPacketCnt():
# read packet into rxBuf, get rxLen length
rxLen = eth.ReceivePacket(rxBuf)
# check if no rx error
if rxLen >= 0:
# print only received data, do not print the entire buffer
print(rxBuf[:rxLen])
else:
print('rx error', rxLen)
It is not clear for me how are you sending the data to your device? A sender need to know MAC address or use broadcast MAC address.
Closing -> responded and no activity.
Hi Looking at and testing your 'Packet reception' script - when I run this code (altered the SPI pins to suit), all I see is the following -
I'm testing it by continuously sending out a data stream from PacketSender
I'm using Port 7 After your line
rxBuf = .......
I simply added
print(rxBuff)
Can you provide any hints ?
I was hoping to see the data
no stuff is not good
what I'm sending at 100ms intervals - somewhere in the Rx packet