diff --git a/py/nativeglue.c b/py/nativeglue.c
index 979265a870a4545d855a4b01255bcef002a068ae..eb02907bdd435968085abf9bb5f93e7d241b64d6 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -65,7 +65,7 @@ mp_uint_t mp_native_from_obj(mp_obj_t obj, mp_uint_t type) {
         case MP_NATIVE_TYPE_UINT: return mp_obj_get_int_truncated(obj);
         default: { // cast obj to a pointer
             mp_buffer_info_t bufinfo;
-            if (mp_get_buffer(obj, &bufinfo, MP_BUFFER_RW)) {
+            if (mp_get_buffer(obj, &bufinfo, MP_BUFFER_READ)) {
                 return (mp_uint_t)bufinfo.buf;
             } else {
                 // assume obj is an integer that represents an address
diff --git a/py/objfun.c b/py/objfun.c
index d96c79ede4998f6bbb14b8de10a877a24e78e106..e0c6fb9271276bad3c10d95df9f537d94d9bf96c 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -472,7 +472,7 @@ STATIC mp_uint_t convert_obj_for_inline_asm(mp_obj_t obj) {
             return (mp_uint_t)items;
         } else {
             mp_buffer_info_t bufinfo;
-            if (mp_get_buffer(obj, &bufinfo, MP_BUFFER_WRITE)) {
+            if (mp_get_buffer(obj, &bufinfo, MP_BUFFER_READ)) {
                 // supports the buffer protocol, return a pointer to the data
                 return (mp_uint_t)bufinfo.buf;
             } else {
diff --git a/tests/inlineasm/asmsum.py b/tests/inlineasm/asmsum.py
index 07e71c738492717c1b450295214f4828ef90df3b..9cbd8418eab5405cbc395eac046e7082d8ecd445 100644
--- a/tests/inlineasm/asmsum.py
+++ b/tests/inlineasm/asmsum.py
@@ -55,3 +55,7 @@ print(b, n)
 b = array.array('b', (10, 20, 30, 40, 50, 60, 70, 80))
 n = asm_sum_bytes(len(b), b)
 print(b, n)
+
+b = b'\x01\x02\x03\x04'
+n = asm_sum_bytes(len(b), b)
+print(b, n)
diff --git a/tests/inlineasm/asmsum.py.exp b/tests/inlineasm/asmsum.py.exp
index d50a94c8db62242752fb9bf927fd47a606c4d230..3c83da367ae7b47e21f49ad29220d4876c3a2acb 100644
--- a/tests/inlineasm/asmsum.py.exp
+++ b/tests/inlineasm/asmsum.py.exp
@@ -1,2 +1,3 @@
 array('l', [100, 200, 300, 400]) 1000
 array('b', [10, 20, 30, 40, 50, 60, 70, 80]) 360
+b'\x01\x02\x03\x04' 10
diff --git a/tests/micropython/viper_addr.py b/tests/micropython/viper_addr.py
index cd953ce07d02d5e93ad0d94f8ef30ab37769b662..0d8efb90b6db7a5e025017472039cf53138cac6e 100644
--- a/tests/micropython/viper_addr.py
+++ b/tests/micropython/viper_addr.py
@@ -9,6 +9,13 @@ def memset(dest:ptr8, c:int, n:int):
     for i in range(n):
         dest[i] = c
 
+@micropython.viper
+def memsum(src:ptr8, n:int) -> int:
+    s = 0
+    for i in range(n):
+        s += src[i]
+    return s
+
 # create array and get its address
 ar = bytearray('0000')
 addr = get_addr(ar)
@@ -27,3 +34,6 @@ print(ar)
 # pass direct pointer to array buffer, with offset
 memset(addr + 2, ord('3'), len(ar) - 2)
 print(ar)
+
+# pass a read-only bytes object in
+print(memsum(b'\x01\x02\x03\x04', 4))
diff --git a/tests/micropython/viper_addr.py.exp b/tests/micropython/viper_addr.py.exp
index 87a18e1e2a067baba9063372504c6ff9b5632d99..8e08db9a54db9dea043a5e55524e6359c5343ad2 100644
--- a/tests/micropython/viper_addr.py.exp
+++ b/tests/micropython/viper_addr.py.exp
@@ -4,3 +4,4 @@ bytearray(b'0000')
 bytearray(b'1111')
 bytearray(b'2222')
 bytearray(b'2233')
+10