AS923 Class C not working?



  • I ran into a problem trying to use class C on AS923.

    Class A works like expected, but when I change to class C, I cannot receive anything. The joining procedure works fine.

    This is my declaration:

    global lora
    lora = LoRa(mode=LoRa.LORAWAN, power_mode=LoRa.ALWAYS_ON, region=LoRa.AS923, device_class=LoRa.CLASS_C)
    

    socket and Hello message:

    pycom.rgbled(0x141400)
    	# create a LoRa socket
    	global lsock
    	lsock = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
    	lsock.setsockopt( socket.SOL_LORA, socket.SO_DR, 2 ) # datarate
    	lsock.setblocking(False)
    	
    	#send Hello packet
    	print('sending Hello')
    	lsock.setsockopt(socket.SOL_LORA, socket.SO_CONFIRMED, 1 )
    	model = 0
    	if 'model' in settings.dic:
    		model = settings.dic['model']
    	send( bytes([ CMD_HI , 3, settings.PROTO_VERSION, settings.SW_VERSION, model ]) )
    

    This is how I wait for a message:

    
    lsock.settimeout(10)
    	lsock.setsockopt( socket.SOL_LORA, socket.SO_CONFIRMED, 0 )
    	print('waiting for data')
    	while(True):
    		try:
    			data, port = lsock.recvfrom(128)
    			proto_handler_multi(data, port)
    		except TimeoutError:
    			send(bytes([0x01,0x00]))
    			#print('still waiting...')
    			continue
    

    The gateway (a CloudGate) receives the message and sends messages when I want to but I don't see anything happening on the LoPy. Anyone ran into this issue before?



  • @jcaron
    I'm using OTAA and can see the joining works like it should.



  • @jcaron said in AS923 Class C not working?:

    I have to admit I don't even know how channel/data rate selection works for class C downlinks... I suppose there must be default channels, and some MAC commands to change that?

    Channel plan is the same for Class A and Class C devices, difference is how downlink delivered. Class A devices listen continously on RX2 channel after RX1 window closed followed by uplink, so you can send downlink any time. Class C is also used for Multicast but as far as I know it is not implemented by PyCom.



  • @harald You may want to check the region-related files in the source code to see if there's anything obvisouly different on the topic for AS923.

    I have to admit I don't even know how channel/data rate selection works for class C downlinks... I suppose there must be default channels, and some MAC commands to change that?

    What type of join are you using? OTAA or ABP?



  • I am Using a CloudGate and create the packets on the gateway itself. I can see the packets being sent, but nothing received on the LoPy. When I changed to EU HW and changed my code to EU868, it worked normally.

    When I send from the LoPy to the gateway, I also see the packets of my LoPy.
    Also Class A functions normally. It looks like it's not listening in Class C when using AS923. How can I confirm this?


  • Global Moderator

    What lorawan server are you using ? You can see downlink packets on your lora gateway ?


 

Pycom on Twitter